2

I have used Process.GetProcessesByName("PROCESSNAME") before in C# to check if a specific project is running.

I have to create a C program for an older embedded version of Windows XP which can only run when another program is also running.

How can I check if the program is running?

Luke
  • 1,077
  • 13
  • 33

2 Answers2

2

The answer to get a Get a process id in C might be helpful to you.

This example uses CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); which can be used to get a snapshot for different processes. (I am assuming you know the name of the process you are checking)

Community
  • 1
  • 1
CAB
  • 38
  • 5
1

Might be a dup of: How can I get a process handle by its name in C++?

And either way, this example that enumerates all processes in the system should get you started:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms682623(v=vs.85).aspx

  • Tim
Community
  • 1
  • 1
Timothy Johns
  • 1,075
  • 7
  • 17