Click here to Skip to main content
15,939,960 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI i need to start a number of process on starting a service,is there any way i can do that with create process? and on stopping that service i need to stop all the instances of all the process started during the start of service how can i do that with terminate process.

Thanks in advance
Praveen
Posted

1 solution

Hi Praveen,

in your services OnStart event handler you'd start the processes you want to start and store them in an appropriate data structure (an array for example).
The OnStop event handler would then iterate over the array containing the process instances and invoke Kill() for each of them.
Te be really shure the processes where stopped check with the HasExited property of the process instance. If you want do some Win32 API magic the Handle property gives you the native Windows OS system handle of the process.

Hope this helps some.

Cheers

Manfred
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900