我用鼠标钩子作鼠标中间的按键响应,我想把中间键按下两秒后做一个响应,代码如下在 OnInitDialog() 中添加
SetWindowsHookEx(WH_MOUSE,MouseProc,NULL,GetCurrentThreadId());
在全局添加
LRESULT CALLBACK MouseProc(
int nCode, // hook code
WPARAM wParam, // message identifier
LPARAM lParam // mouse coordinates
)
{
if(WM_MBUTTONDOWN==wParam)
{
SetTimer(0,2000,NULL);//设立计数器,时间为2000
return 1;
}
else
return 0;
}然后再OnTimer 里面写的我的相应操作,但是它会抱错的
error C2660: 'SetTimer' : function does not take 3 parameters好像在鼠标钩子的判断里面不能加一些东西,好像那些东西还没有初始化,我把钩子过程函数放到OnInitDialog() 的下面,抱错更多,要解决我这种想法,怎么做呢?高手们帮帮忙,谢谢了!
SetWindowsHookEx(WH_MOUSE,MouseProc,NULL,GetCurrentThreadId());
在全局添加
LRESULT CALLBACK MouseProc(
int nCode, // hook code
WPARAM wParam, // message identifier
LPARAM lParam // mouse coordinates
)
{
if(WM_MBUTTONDOWN==wParam)
{
SetTimer(0,2000,NULL);//设立计数器,时间为2000
return 1;
}
else
return 0;
}然后再OnTimer 里面写的我的相应操作,但是它会抱错的
error C2660: 'SetTimer' : function does not take 3 parameters好像在鼠标钩子的判断里面不能加一些东西,好像那些东西还没有初始化,我把钩子过程函数放到OnInitDialog() 的下面,抱错更多,要解决我这种想法,怎么做呢?高手们帮帮忙,谢谢了!
HWND hWnd, // handle of CWnd that called SetTimer
UINT nMsg, // WM_TIMER
UINT nIDEvent // timer identification
DWORD dwTime // system time
);