Someone can help me to make a system wide MouseProc with VC++??
Here is the code i wrote:
the DLL - main.c
Code:
#include <windows.h>
#include "DLL.h"
// tutte le funzioni devono essere precedute da __stdcall
LRESULT CALLBACK __stdcall MouseProc (int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HC_ACTION)
{
if (wParam == WM_LBUTTONDOWN)
{
MessageBox (NULL, "ciao", "ciao", MB_OK);
return 1;
}
}
return CallNextHookEx (hMouseHook, wParam, lParam);
}
here I have a problem..... VC++ says hMouseHook is an undeclared variable. ok it is true, but How can I make it a non-undeclared variable?
The DLL - exports.def
Code:
LIBRARY "DLL.dll"
EXPORTS
MouseProc
The DLL - DLL.h
Code:
#include <windows.h>
LRESULT CALLBACK __stdcall MouseProc (int nCode, WPARAM wParam, LPARAM lParam);
The function calling the MouseProc:
Code:
void hello ()
{
MYFUNCTION pFunction = 0;
HINSTANCE hDLL;
HOOKPROC a;
HHOOK hMouseHook
hDLL = LoadLibrary ("DLL.dll");
a = (HOOKPROC)GetProcAddress (hDLL, "MouseProc");
b = SetWindowsHookEx (WH_MOUSE, a, hDLL, 0);
}
I forgot to say that there's also this line at the beginning of the program
typedef void (*MYFUNCTION)(int, WPARAM, LPARAM);