How to terminate a process created with CreateProcess(...) 
Author Message
 How to terminate a process created with CreateProcess(...)

Hai there,

In try to start and stop an application from my program.

To start the application i use the CreateProcess call who gives me
PROCESS_INFORMATION on return.
To stop the application i used the TerminateProcess call but this
call doesn't clean up the started applications administration completely
(see help pages) which makes it impossible to start some applications
for
the second time. So i can't use the TerminateProcess call.

A better solution for this problem is to sent a WM_CLOSE message to
the started application but i only can sent messages if a know the
main HWND of the started application.

My question:
How can i obtain the HWND of the main windows of the started
application when i only have the PROCESS_INFORMATION returned by
CreateProcess?

Any suggestions?

I'm using VC++ 4.2b under Windows 95.

Please reply by Email.

Ruud Cox
Eindhoven, Netherlands



Sat, 07 Aug 1999 03:00:00 GMT  
 How to terminate a process created with CreateProcess(...)


Fri, 19 Jun 1992 00:00:00 GMT  
 How to terminate a process created with CreateProcess(...)

Hi Ruud,

<<
My question:
How can i obtain the HWND of the main windows of the started
application when i only have the PROCESS_INFORMATION returned by
CreateProcess?

The PROCESS_INFORMATION includes a process id member. What you can do is
call EnumWindows to enumerate all top level windows and, with each window
handle you get, call GetWindowThreadProcessId. Compare this process id with
the one you've got from PROCESS_INFORMATION, if it matches, you have your
window handle.

I hope that solves the problem for you.

Krishnan

Aditi Corp.

 Aditi Corp was formerly known as NetQuest Inc.



Sun, 08 Aug 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CreateProcess dosen't create process

2. CreateProcess dosen't create process

3. Createprocess, is not creating a process?

4. how to terminate a new created process?

5. How do I terminate a process that I created

6. CreateProcess & terminating

7. DOS app terminates too soon using ::createprocess()

8. Starting process with CreateProcess as icon

9. How to kill a process started with CreateProcess?

10. RAPI CreateProcess - has process ended?

11. Terminating a child process

12. Process suddenly terminates without notification

 

 
Powered by phpBB® Forum Software