How could I monitor the windows message and identify which pop up dialogue box belongs to which applicaion window.
I am building a test application to monitor what was activated and capture the events.
Printable View
How could I monitor the windows message and identify which pop up dialogue box belongs to which applicaion window.
I am building a test application to monitor what was activated and capture the events.
To get the caption of any window, you can use "GetWindowText" api call. To find popup windows, you can use "FindWindow" api call.
Here's an example of using GetWindowText (replace hwnd with the handle of the window)
VB Code:
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Private Sub Command1_Click() Dim sTitle As String Dim iLength As Integer sTitle = Space$(256) iLength = GetWindowText(hwnd, sTitle, 256) sTitle = Left$(sTitle, InStr(1, sTitle, vbNullChar) - 1) MsgBox sTitle End Sub