views:

219

answers:

2

Hi

You can create a thread given a delegate to method, can I create a process in the same way? I want to do that to be able to close the child process from task manger if something goes wrong.

I expect the answer is no and the only typical way is windows service.

Thanks

A: 

Could try something like this (C#):

Process proc = new Process();
ProcessStartInfo procInfo = new ProcessStartInfo("C:\\test.exe");
proc.Start(procInfo);
Chris Stavropoulos
+1  A: 

If by "same way", you mean passing a delegate as an argument for a given process then no, this is not possible. You will have to create a new executable which would do some tasks based on command line parameters. Though, the general rule is to avoid process spawning as it's VERY expensive.

Sylvestre Equy