WINDOWS HOOK中WM_GETMESSAGE钩子 函数三个参数的内容

比如我想判断消息是WM_KEYDOWN还是WM_KEYUP,该怎么办?

在钩子的回调函数里判断
HHOOK SetWindowsHookEx(

int idHook, // type of hook to install
HOOKPROC lpfn, // address of hook procedur 在这里。。回调函数指针地址
HINSTANCE hMod, // handle of application instance
DWORD dwThreadId // identity of thread to install hook for
);
LRESULT CALLBACK GetMsgProc(//回调函数

int code, // hook code
WPARAM wParam, // removal flag
LPARAM lParam // address of structure with message
);
我来写一下吧
SetWindowsHookEx(hook,Go,NULL,0);
LRESULT CALLBACK Go(
int code, WPARAM wParam, LPARAM lParam
)
{///lParam [in]
//Type: LPARAM
//A pointer to an MSG structure that contains details about the message.
MSG * pMsg=(MSG*)lParam;   //在这里我已经作了转换啊,可是发过去的消息好像还是不对。
                             
switch(pMsg->message)
{
case WM_KEYDOWN)
:
SendMessage(g_hwnd,WM_HOOK_MESSAGE,wParam,lParam);
break;
}}
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-12-16
GetMessage()