Here\'s my problem: we have an automated build process for our product. During the compilation of one of the VB6 projects a message box is spit out that requires the user t
When you find the message box, try sending it WM_NOTIFY
with a BN_CLICKED
type and the ID of the OK button.
You have to found the window, that is the first step. After you can send the SC_CLOSE
message using SendMessage
.
[DllImport("user32.dll")]
Public static extern int SendMessage(int hWnd,uint Msg,int wParam,int lParam);
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
IntPtr window = FindWindow(null, "Location Browser Error");
if (window != IntPtr.Zero)
{
Console.WriteLine("Window found, closing...");
SendMessage((int) window, WM_SYSCOMMAND, SC_CLOSE, 0);
}