Declaration of _Everything_SendAPIBoolCommand?
Declaration of _Everything_SendAPIBoolCommand?
A definition for _Everything_SendAPIBoolCommand is in everything.c. But it's not declared anywhere. How do I use it in another module?
Thanks.
Thanks.
Re: Declaration of _Everything_SendAPIBoolCommand?
The SDK source code is provided in the SDK:
In short, find the Everything IPC window and send a window message.
Code: Select all
static BOOL _Everything_SendAPIBoolCommand(int command,LPARAM lParam)
{
HWND everything_hwnd;
everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0);
if (everything_hwnd)
{
_Everything_LastError = 0;
if (SendMessage(everything_hwnd,EVERYTHING_WM_IPC,command,lParam))
{
return TRUE;
}
else
{
return FALSE;
}
}
else
{
// the everything window was not found.
// we can optionally RegisterWindowMessage("EVERYTHING_IPC_CREATED") and
// wait for Everything to post this message to all top level windows when its up and running.
_Everything_LastError = EVERYTHING_ERROR_IPC;
return FALSE;
}
}
Re: Declaration of _Everything_SendAPIBoolCommand?
Having included everything.c in my project, I can't use it in another module.
Re: Declaration of _Everything_SendAPIBoolCommand?
Are you looking to export this function so it can be called externally from a dll?
Re: Declaration of _Everything_SendAPIBoolCommand?
Remove static from the function definition and declare the function as:
Code: Select all
BOOL _Everything_SendAPIBoolCommand(int command,LPARAM lParam);
Re: Declaration of _Everything_SendAPIBoolCommand?
Removed "static" in everything.c (declaration and definition). I get "linker: unresolved external" when I try to call it from another source module.
It works if I put the definition in my own source module.
And doing it in my own FindWindow/SendMessage also works.
It works if I put the definition in my own source module.
And doing it in my own FindWindow/SendMessage also works.
Re: Declaration of _Everything_SendAPIBoolCommand?
You'll need to include the following in your module:
(can also be declared in one of your header files)
Code: Select all
BOOL _Everything_SendAPIBoolCommand(int command,LPARAM lParam);
Re: Declaration of _Everything_SendAPIBoolCommand?
I tried all that, several times. No matter where I declare it (without "static") if the definition (without "static") is in everything.c and I call it from another source module I can't link with it. That's unlike a number of other functions defined in everything.c (e.g., Everything_SetRegex (and friends)) which I can call from another source module.
It is not critical. As I said if I define _Everything_SendAPIBoolCommand in my own source module (as it's defined in everything.c) it works. And my own function (using FindWindow and SendMessage) also works. I was hoping to learn something here.
It is not critical. As I said if I define _Everything_SendAPIBoolCommand in my own source module (as it's defined in everything.c) it works. And my own function (using FindWindow and SendMessage) also works. I was hoping to learn something here.
Re: Declaration of _Everything_SendAPIBoolCommand?
This issue can occur if the definition still contains the static keyword.
Please make sure both the declaration and definition do not have the static keyword in everything.c
Please make sure both the declaration and definition do not have the static keyword in everything.c
Re: Declaration of _Everything_SendAPIBoolCommand?
As I said, I tried that.
Here's another (related?) question. I invented my own ...
everything.h (modelled after Everything_Exit, which I can successfully use)
EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_ShowOptionsDialog(void); // vef
everything.c (modelled after Everything_Exit, which I can successfully use)
BOOL EVERYTHINGAPI Everything_ShowOptionsDialog(void) // vef
{
return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_ID_TRAY_OPTIONS, 0);
}
everything.c and es.cpp are included in my project
es.cpp includes everything.h and calls Everything_ShowOptionsDialog().
The project builds OK.
Everything_ShowOptionsDialog() doesn't work. It returns 0;
Here's another (related?) question. I invented my own ...
everything.h (modelled after Everything_Exit, which I can successfully use)
EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_ShowOptionsDialog(void); // vef
everything.c (modelled after Everything_Exit, which I can successfully use)
BOOL EVERYTHINGAPI Everything_ShowOptionsDialog(void) // vef
{
return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_ID_TRAY_OPTIONS, 0);
}
everything.c and es.cpp are included in my project
es.cpp includes everything.h and calls Everything_ShowOptionsDialog().
The project builds OK.
Everything_ShowOptionsDialog() doesn't work. It returns 0;
Re: Declaration of _Everything_SendAPIBoolCommand?
Please try wrapping the _Everything_SendAPIBoolCommand declaration in an extern "C":
EVERYTHING_IPC_ID_TRAY_OPTIONS is not an IPC command.
It will not work with _Everything_SendAPIBoolCommand
Please try:
Code: Select all
#ifdef __cplusplus
extern "C" {
#endif
BOOL _Everything_SendAPIBoolCommand(int command,LPARAM lParam);
#ifdef __cplusplus
}
#endif
EVERYTHING_IPC_ID_TRAY_OPTIONS is not an IPC command.
It will not work with _Everything_SendAPIBoolCommand
Please try:
Code: Select all
SendMessage(FindWindow(EVERYTHING_IPC_WNDCLASS,0),WM_COMMAND,MAKEWPARAM(EVERYTHING_IPC_ID_TRAY_OPTIONS,0),0);
Re: Declaration of _Everything_SendAPIBoolCommand?
My mistake! Is there an IPC command to open the options dialog (also open the search window and open a new search window).
Re: Declaration of _Everything_SendAPIBoolCommand?
There's no EVERYTHING_WM_IPC command to open the options window or create a new window.
You will need to send a WM_COMMAND to the same tray window instead.
You will need to send a WM_COMMAND to the same tray window instead.
Code: Select all
#define EVERYTHING_IPC_ID_TRAY_NEW_SEARCH_WINDOW 40001
#define EVERYTHING_IPC_ID_TRAY_CONNECT_TO_ETP_SERVER 40004
#define EVERYTHING_IPC_ID_TRAY_OPTIONS 40005
#define EVERYTHING_IPC_ID_TRAY_EXIT 40006
#define EVERYTHING_IPC_ID_TRAY_SHOW_SEARCH_WINDOW 40007
#define EVERYTHING_IPC_ID_TRAY_TOGGLE_SEARCH_WINDOW 40008
Re: Declaration of _Everything_SendAPIBoolCommand?
That's what I have been doing. It works fine but I was curious about another way.
Thanks for all the help. Sorry if I've been a pain.
Thanks for all the help. Sorry if I've been a pain.