Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim WinHandle As IntPtr
Me.Show()
Do
Threading.Thread.Sleep(1000)
WinHandle = FindWindow(vbNullString, "Message box title")
Application.DoEvents()
If WinHandle.ToInt32 > 0 Then
ClickButton()
End If
Loop
End Sub
|