为什么会出错?
mfc吧
全部回复
仅看楼主
level 6
静阿妖晗拽1L
楼主
error C2664: 'SetWindowsHookExA' : cannot convert parameter 2 from 'long (int,unsigned int,long)' to 'long (__stdcall *)(int,unsigned int,long)'
看了下HOOK机制,想做下最简单的测试,结果
代码楼下
2014年12月10日 02点12分
1
level 6
静阿妖晗拽1L
楼主
LRESULT CALLBACK CHOOKDlg::MouseProc(int nCode, WPARAM wParam, LPARAM lParam)//函数声明
SetWindowsHookEx(WH_MOUSE,MouseProc,NULL,GetCurrentThreadId());//报错的调用行
2014年12月10日 02点12分
2
level 6
静阿妖晗拽1L
楼主
函数名不是可以做函数入口指针吗?为什么会提示无法从long (int,unsigned int,long)转换到'long (__stdcall *)(int,unsigned int,long)
2014年12月10日 02点12分
3
89198408
你那函数声明时加上__stdcall 关键字 C++默认调用约定为 _CEDL
2014年12月10日 03点12分
89198408
手误:默认是_cdecl
2014年12月10日 04点12分
静阿妖晗拽1L
回复 89198408 :CALLBACK和WINAPI两个宏的定义就是_stdcall啊
2014年12月10日 05点12分
89198408
回复 Death_莫殇 :刚没留意看你的2楼,若是类成员函数,则只有静态成员函数能当回调函数用
2014年12月10日 06点12分
1