I am creating process using create process does anyone knows how to use create function if process is already running not create or externally having any other way to detect process is running.
Asked
Active
Viewed 104 times
0
-
You should search for interprocess synchronization tools. But you really should show your current research if you expect more detailed answers... Please read [ask] if you cannot understand the reason for my last sentence. – Serge Ballesta Oct 20 '22 at 13:43
-
Are you able to amend the source of the program being started by `CreateProcess` ? – Richard Critten Oct 20 '22 at 13:44
-
Maybe this can help: https://stackoverflow.com/questions/3477097/get-full-running-process-list-visual-c. – wohlstad Oct 20 '22 at 14:05
-
IIRC, Raymond Chen had a blog post on this subject. In short, there is no clear answer, because there's no clear definition of running. Is a process that has a visible window "running"? What if that window is "Please wait, loading 3/100..." ? – MSalters Oct 20 '22 at 15:36
1 Answers
0
On Windows, you use the Process Status API (PSAPI) to search through all the processes running on the system. The degree of access you have to this resource will depend on the privileges that the program is running under.
See the MSDN article
Specifically, you would invoke the EnumProcesses function to get a full list of the running processes IDs, then, using those IDs use other functions in the API to get information about them. For example, to get a processes name, and have it's ID already, you could call GetProcessImageFileName.
Beware that these functions have ASCII and Wide-character versions.

JimmyNJ
- 1,134
- 1
- 8
- 23