LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Windows SDK: TerminateProcess

I have received a very excellent reply from Sacha Emery.

I have, however, a further question (if that isn't being too greedy).

The attached code fragment will launch an application and quite happily minimise and restore that application.
My question is regarding the termination of the application.
I have used Sacha's example and incorporated it into my own code.
It works very successfully at launching minimising and restoring the application on the desktop.

My problem is that I cannot successfully terminate the application.
It maybe because I'm using the wromg function call - TerminateProcess rather than ExitProcess, but I suspect that it may be related to the fact that I'm using the wrong handle to terminate the application.

Could anyone kindly advise me of the correct method to employ.

Forever in your debt
Damien.

PS I have issues regarding launching an application that does not contain a menu bar. Is this expected if I specify assign sInfo.wShowWindow = SW_SHOWMINIMIZED in the call to
CreateProcess(NULL, CMFD_EMULATOR_PATH, NULL, NULL, FALSE,
CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &sInfo, &pInfo);
0 Kudos
Message 1 of 2
(3,061 Views)
TerminateProcess uses a process handle, not a window handle (if I am not wrong). Should be thread related. Anyways try CloseWindow API from User32.
0 Kudos
Message 2 of 2
(3,057 Views)