鼠标三击的实现
【打印文章】
void click_3()
{
}
BOOL CDlgApp::PreTranslateMessage(MSG* pMsg)
{
static short flag=0,flagtime=0;
UINT time;
static MSG tempMsg;
static DWORD t1,t2,t3=20000;
time=GetDoubleClickTime();
t2=GetTickCount();
if((pMsg->message == WM_LBUTTONDBLCLK )¦¦(pMsg->message ==WM_LBUTTONDOWN))
{
if(pMsg->message == WM_LBUTTONDBLCLK )
{
t1=GetTickCount();
flag=1;flagtime=1;
tempMsg.hwnd =pMsg->hwnd;
tempMsg.message=pMsg->message;
tempMsg.lParam=pMsg->lParam;
tempMsg.wParam=pMsg->wParam;
return true;
}
if(pMsg->message == WM_LBUTTONDOWN)
{
if(flag==1)
{
t2=GetTickCount();
t3=t2-t1;
if(t3<time)
{
click_3();
flag=0;flagtime=0;
return true;
}
flag=0;
}
}
}else{
if(flagtime)
{
t3=t2-t1;
if(t3>time)
{
flagtime=0;
return CWinApp::PreTranslateMessage(&tempMsg);
}
}
}
return CWinApp::PreTranslateMessage(pMsg);
}
{
}
BOOL CDlgApp::PreTranslateMessage(MSG* pMsg)
{
static short flag=0,flagtime=0;
UINT time;
static MSG tempMsg;
static DWORD t1,t2,t3=20000;
time=GetDoubleClickTime();
t2=GetTickCount();
if((pMsg->message == WM_LBUTTONDBLCLK )¦¦(pMsg->message ==WM_LBUTTONDOWN))
{
if(pMsg->message == WM_LBUTTONDBLCLK )
{
t1=GetTickCount();
flag=1;flagtime=1;
tempMsg.hwnd =pMsg->hwnd;
tempMsg.message=pMsg->message;
tempMsg.lParam=pMsg->lParam;
tempMsg.wParam=pMsg->wParam;
return true;
}
if(pMsg->message == WM_LBUTTONDOWN)
{
if(flag==1)
{
t2=GetTickCount();
t3=t2-t1;
if(t3<time)
{
click_3();
flag=0;flagtime=0;
return true;
}
flag=0;
}
}
}else{
if(flagtime)
{
t3=t2-t1;
if(t3>time)
{
flagtime=0;
return CWinApp::PreTranslateMessage(&tempMsg);
}
}
}
return CWinApp::PreTranslateMessage(pMsg);
}
本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。( Pfan.cn )
【编程爱好者论坛】