Dmitry_Nikolaev
Staff
10 years agoHello,
I can suggest using a workaround: I have created a simple PowerShell script that will close all TestComplete error messages automatically one by one. Please find this script below - save it to a file with the *.PS1 extension. Information on how to run a script can be found in the Running a PowerShell Script from Windows section of this blog article.
$definition = @"
[DllImport("user32.dll")]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);
const int WM_CLOSE = 0x0010;
public static int getWnd(string wClass, string wName)
{
int hwnd = 0;
int endTime = System.Environment.TickCount + 3000;
while (hwnd == 0) {
hwnd = (int)FindWindow(wClass, wName);
if (hwnd > 0)
return hwnd;
if (System.Environment.TickCount > endTime)
return 0;
}
return 0;
}
public static void Close(string wClass, string wName)
{
int hwnd = getWnd(wClass, wName);
while (hwnd > 0) {
SendMessage(hwnd, WM_CLOSE, 0, 0);
System.Threading.Thread.Sleep(1000);
hwnd = getWnd(wClass, wName);
}
}
"@
add-type -MemberDefinition $definition -Namespace my -Name WinApi
[my.WinApi]::Close('TMessageForm', 'TestComplete')