I am using SendMessage()
to send a BM_CLICK
to a button that opens a popup window and then trying to use FindWindow()
to find the ID for this window. When I manually click the button or press enter once selecting the button I can find the window ID fine but when I send the button a BM_CLICK
message I am unable to find the window. I've set a timer in case I was looking for the window too early but no luck. Is there any difference between an actual click and using BM_CLICK
that would cause this problem? Here is my code:
Call SendMessage(hist_ID, BM_CLICK, 0, 0)
Sleep 500
hist_window_id = FindWindow("ThunderRT6FormDC", "Select History Data")
timeout = 0
Do While hist_window_id = 0
If timeout < 20 Then
Sleep 50
hist_window_id = FindWindow("ThunderRT6FormDC", "Select History Data")
timeout = timeout + 1
Else
MsgBox "System Timeout"
Exit Function
End If
Loop