In my program, I wanna replace DoEvents with something faster and close to how C++ does it. The only events I wanna check are painting events, mouse events, and keyboard events, window moving and resizing. I plan on using the GetMessage TranslateMessage and DispatchMessage APIs but can't find the stinking constant values to messages such as WM_PAINT as well as the others, if not all of em. I know there are other ways, and I'm well aware of em as I tinkered with this stuff in the past (literally all of em such as GetQueueStatus, GetInputState etc.) But I don't wanna use them. I had the code to do the GetMessage TranslateMessage and DispatchMessage APIs a few years ago, but the code is long gone, and Google isn't even helping much either. The setup I know is kinda like this:
Just that I don't know what the constants are for the messages, and practically forgot completely on how to handle em. It's 3 in the morning so I'll get back to respond sometime when I'm actually awake. Thanks in advance. :bigyello:
Code:
Public Type Message_Type
hwnd As Long
Message As Long
wParam As Long
lParam As Long
Time As Long
ptX As Long
ptY As Long
End Type
Public Declare Function GetMessage Lib "user32" Alias "GetMessageA" (lpMsg As Message_Type, ByVal hwnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
Public Declare Function TranslateMessage Lib "user32" (lpMsg As Message_Type) As Long
Public Declare Function DispatchMessage Lib "user32" Alias "DispatchMessageA" (lpMsg As Message_Type) As Long
Public Msg As Message_Type
Public Sub DoEvents_Replacement()
While GetMessage(Msg, frmMain.hWnd, 0, 0)
TranslateMessage Msg
DispatchMessage Msg
Wend
End Sub