Code:
#include <windows.h>
typedef struct _MYHOOKDATA
{
int nType;
HOOKPROC hkprc;
HHOOK hhook;
} MYHOOKDATA;
int index;
MYHOOKDATA myhookdata;
MSG messages;
LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nFunsterStil){
myhookdata.nType = WH_KEYBOARD;
myhookdata.hkprc = KeyboardProc;
myhookdata.hhook = SetWindowsHookEx(
myhookdata.nType,
myhookdata.hkprc,
(HINSTANCE) NULL, GetCurrentThreadId());
while (GetMessage (&messages, NULL, 0, 0)){
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return 0;
}
LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
CHAR szBuf[128];
HDC hdc;
static int c = 0;
size_t cch;
size_t * pcch;
HRESULT hResult;
if (nCode < 0) // do not process message
return CallNextHookEx(myhookdata.hhook, nCode,
wParam, lParam);
MessageBox(HWND_DESKTOP,"hello","hello",MB_OK);
return CallNextHookEx(myhookdata.hhook, nCode, wParam,
lParam);
}
Mixed up something awful...
Ofcourse this doesn't work...