-1

I need to get information about running processing Windows.

What can I write to make the program give a list like this: working applications: Opera, Teamspeak. It's a little bit like task manager in Windows.

dreamcrash
  • 47,137
  • 25
  • 94
  • 117
mkingmking
  • 41
  • 1
  • 8
  • 2
    It is not at all clear what you are asking. The posted code clearly does not do what you want, but the part that specifies what you do want appears to be vague and incomplete. If all you want is a list of running processes, then say that - the code does not do that so is probably irrelevant to the question. Also any OS or just POSIX OSes - a Windows implementation would look very different. – Clifford Apr 05 '21 at 16:57
  • Sorry. I'll arrange it. I wrote them because it was the only thing popped up when I searched the internet. I also read somewhere else that those type of works are done by .net framework in C#. But I want to do it in C. – mkingmking Apr 05 '21 at 16:59
  • Perhaps a duplicate of https://stackoverflow.com/questions/939778/linux-api-to-list-running-processes – Clifford Apr 05 '21 at 17:02
  • Yes, It's very similar to what I'm wondering but I need to do that in Windows. that question here was in Linux. I realised now that I didn't write "for windows" in the question I'm sorry again. – mkingmking Apr 05 '21 at 17:06
  • 1
    You say that now (and in the edit) but your original code used `uname()` which is a POSIX call, and the [operating-system] tag was non specific. – Clifford Apr 05 '21 at 17:24
  • 1
    **Did you read the documentation of the [Windows API](https://learn.microsoft.com/en-us/windows/win32/apiindex/windows-api-list)?** You need to spend a week in reading that documentation! Then you might find open source software (e.g. on http://github.com/) using that API – Basile Starynkevitch Apr 05 '21 at 17:36
  • 1
    Wow, thank you so much for sharing that. I didn't even know something like this exists. This even covers my future questions. Thanks again! – mkingmking Apr 05 '21 at 17:41
  • @mkingmking : You didn't think there might be documentation for the Windows API?! Perhaps that should have been your fist question. – Clifford Apr 05 '21 at 21:46
  • It was definitely my first question. It has been 2 months since I registered but this is the first time I actually needed to ask something. Thanks again for making me learn valuable things! – mkingmking Apr 06 '21 at 08:15

2 Answers2

1

Get a list of processes with EnumProcesses(), which you can then iterate to get information on the individual processes using the Process API functions such as GetModuleBaseName() as described in the example at https://learn.microsoft.com/en-us/windows/win32/psapi/enumerating-all-processes

Clifford
  • 88,407
  • 13
  • 85
  • 165
1

You can use either:

Once you have the EXE filenames, you can use GetFileVersionInfo() and VerQueryValue() to retrieve their human-readable display names, such as from the FileDescription version info field.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770