简体   繁体   中英

Identifying a running program in Windows

I have the following scenario, I need to detect a particular program running in windows before I can execute my program, for example my program needs to know if LogMeIn is actually installed and running to proceed, I have used some approaches like enumerating processes using psapi.dll but I think that the process name could change in the installation and configuration stage, so I dont know how to make sure that I can find always the process independently of this. I am using some tests based upon the following code snippets: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682623(v=vs.85).aspx

The other approach is to use the registry code but I detect that it could be modified too and it is not standard.

If the program you want to track is windowed (so a windows iss shown) and the window title is something you predict. You can use the EnumWindows function. If the title changes but still have some words that are the same accross the different run, you can use regular expression to see if the name match what you want. Example:

LogMeIn running...

2012-03-27: LogMeIn

Those two string share a common and explicit name, so you can tell that will be what your looking for. You can apply this reasonning to the EnumProcess method

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM