关于鼠标钩子的问题,如何获得鼠标回调函数中的消息wParam!
写了个 钩子
LRESULT CALLBACK MouseProc(
int nCode, // hook code
WPARAM wParam, // message identifier
LPARAM lParam // mouse coordinates
)
{
MOUSEHOOKSTRUCT *mouse;
mouse=(MOUSEHOOKSTRUCT*)lParam;
char all[200];
sprintf(all,"鼠标%d x:%d y:%d",wParam,mouse->pt.x,mouse->pt.y);
FILE *file=fopen("mouse.txt","a");
fwrite(all,1,strlen(all),file);
fclose(file);
return 0;
}
一开始用的是
sprintf(all,"鼠标%s x:%d y:%d",wParam,mouse->pt.x,mouse->pt.y);
结果显示
鼠标(null) x:701 y:275
后来改
sprintf(all,"鼠标%d x:%d y:%d",wParam,mouse->pt.x,mouse->pt.y);
结果是
鼠标512 x:701 y:275鼠标512 x:704 y:276鼠标512 x:705 y:276鼠标
我如何知道512 是单急 双急 左急还是右击 !!!