devxlogo

DiscardMouseMessages – Prevent queud mouse actions from being processed

DiscardMouseMessages – Prevent queud mouse actions from being processed

Private Type POINTAPI    X As Long    Y As LongEnd TypePrivate Type MSG    hwnd As Long    message As Long    wParam As Long    lParam As Long    time As Long    pt As POINTAPIEnd TypePrivate Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" (lpMsg _    As MSG, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, _    ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As LongPrivate Const PM_REMOVE = &H1Private Const WM_MOUSEFIRST = &H200Private Const WM_MOUSELAST = &H209' Discard mouse messages waiting to be processed'' This procedure is sometimes useful to prevent VB' from processing spurious mouse clicksPrivate Sub DiscardMouseMessages(ByVal hWnd As Long)    Dim dummy As MSG    Do While PeekMessage(dummy, hWnd, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE)        ' continue to loop until there are no more mouse messages    Loop    End Sub

devx-admin

Share the Post: