Use
EnumProcesses()[
^] to get the ProcessId list of the currently running programs. (You should do this periodically, every 1, or 5 seconds or something like that if you want a resident program.) And of course you want to get some info about every process to decide if you have to take action or not. To get some info about a process you usually need a handle to the process (not the id). Use
OpenProcess()[
^] to obtain a handle to a process by its id. Then you can use for example
GetModuleFilenameEx()[
^] to find out the path of the executable that was used to create that process (pass in NULL as the hModule parameter). You may also want to check out stuff here:
PSAPI[
^]
And turning the monitor on/off is the same in C/C++ as in the article your found, here is a the article written in C:
Turn on/off monitor[
^]