04-06-2008 07:47 PM - edited 04-06-2008 07:49 PM
04-07-2008 03:10 PM
Hi Paulbin,
your words sounds from daily trouble in production line. You have written a programm and one part of it is from a supplier and this stuff is crashing and you HAVE to use it. You have spent hours and sometimes days with stupid workarounds and threads to keep it stable as possible. But for the production you are always the idiot. So welcome to club of TestStand idiots. I am a member since serval years.
Recently i have focused the Call Executable Step-Type. If you select "Wait for specified time" after this time the SDK Kill Process will be executed. Normally you know how long it takes.
If the dead time is reached windows kills the stuff. Oh! what about unclosed handles? You will see it on restarting uut. If it crashes at once you a stupid problem (I am sure you know it) but
if you have luck it could work extremly well and you are the winner.
One of my stranges workarounds was pressing a start button from supplier win32 application. Sounds boring but it as controlled by TS
Curious? Very Simple! Get the process handle. Then get the HWND of the process . Now take over the mousepointer and fake the mouse. Place the arrow to the button and
a WM_BUTTON_LEFT_CLICK. Thats all. Oh you can do this with Stop-Button, too.
Thanks for shaking out my heart
and greetings from the lake of constance, Germany
Juergen
All other Teststand-Idiots are welcome to shaking out their heart.
Or you have great TS workaround like injecting own code to external app/dll so post it here.
04-08-2008 01:17 AM
Hi man.
Should I write a VC dll for TestStand on get HWND and then control the mouse or is there any existing way to do in TestStand?
04-08-2008 02:08 AM
Hi,
I have used a VC++ dll
Here are some snipptes
void CProcessLoaderApp::PostMessageToProcess(LPPROCESS_INFORMATION lpProcessInformation,UINT Msg, WPARAM wParam, LPARAM lParam)
{
FINDWINDOWHANDLESTRUCT fwhs;
fwhs.ProcessInfo = lpProcessInformation;
fwhs.hWndFound = NULL;
EnumWindows ( EnumWindowCallBack, (LPARAM)&fwhs ) ;
PostMessage ( fwhs.hWndFound, Msg, wParam, lParam );
}
BOOL CALLBACK CProcessLoaderApp::EnumWindowRcs5SystemTestCallBack(HWND hwnd, LPARAM lParam)
{
FINDWINDOWHANDLESTRUCT * pfwhs = (FINDWINDOWHANDLESTRUCT * )lParam;
DWORD ProcessId;
CString Title;
GetWindowThreadProcessId ( hwnd, &ProcessId );
// note: In order to make sure we have the MainFrame, verify that the title
// has Zero-Length. Under Windows 98, sometimes the Client Window ( which doesn't
// have a title ) is enumerated before the MainFrame
CWnd::FromHandle( hwnd )->GetWindowText(Title);
if ( ProcessId == pfwhs->ProcessInfo->dwProcessId && Title.Compare("MyApplicationName_ReplaceThatStuff") == 0)
{
pfwhs->hWndFound = hwnd;
return false;
}
else
{
// Keep enumerating
return true;
}
}
MainStuff:
SetCursorPos(10,23);
m_App.PostMessageToProcess(&g_pi,WM_LBUTTONDOWN,0x01,0x000A0017);
WaitForSingleObject(Event,200);
m_App.PostMessageToProcess(&g_pi,WM_LBUTTONUP,0x00,0x000A0017);
WaitForSingleObject(Event,200);
Greetings
juergen