c# - Windows how to get the process group of a process that is already running? -


i have wpf application starts new process using process.start(processstartinfo info).

how group process id of process can send ctrl+c signal using generateconsolectrlevent? https://msdn.microsoft.com/en-us/library/windows/desktop/ms683155%28v=vs.85%29.aspx

however, can't seem find group process id of console window in new process created. has session id cur windows user , process id.

edit: got program work still never found true answer real question.

i able send ctrl c process using generateconsolectrlevent broadcast processes in console.

however, not able figure out how process group of process running. can of course save process group if create new process (it should id of process called createprocess creation flag create new process group). however, cannot find related grabbing id if not making new group , wish know group process belongs to. surely information stored somewhere , can retrieved!

i can parent id in windows nt versions using function: fetching parent process id child process

however, not guarantee same process group. starting conclude windows not have process group id process id function.

linux has simple getpgrp function want looking for. don't understand why windows has process group if can't value of it

the documentation generateconsolectrlevent states (emphasis mine):

the identifier of process group receive signal. process group created when create_new_process_group flag specified in call createprocess function. the process identifier of new process process group identifier of new process group.

so if processes in group, wpf application's pid should group id.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -