1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| Type MSG
hwnd As Long
message As Long
wParam As Long
lParam As Long
Time As Long
pt As POINTAPI
End Type
Type POINTAPI
x As Long
y As Long
End Type
Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
Declare Function TranslateMessage Lib "user32" Alias "TranslateMessage" (lpMsg As MSG) As Long
Declare Function DispatchMessage Lib "user32" Alias "DispatchMessageA" (lpMsg As MSG) As Long
Private Declare Function GetMessage Lib "user32" Alias "GetMessageA" (lpMsg As MSG, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
Const WM_QUIT = &H12
sub main
'******
While IsWindow(objwindow.WindowHandle)
DoSomething
Wend
'******
end sub
Sub DoSomething()
Dim msg As MSG
If GetMessage(msg, 0&, 0&, 0&) Then
If msg.message = WM_QUIT Then
Exit Sub
End If
Call TranslateMessage(msg)
Call DispatchMessage(msg)
End If
End Sub |
Partager