鼠标三击的实现

发表于:2007-07-14来源:作者:点击数: 标签:
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_LBUTTONDBLCL
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);

}

原文转自:http://www.ltesting.net