简体   繁体   中英

Monitoring a process in Windows

How can I monitor a Windows process and start it up if it is not running? I'd like to have something that starts up as a Windows service and can handle multiple processes.

EDIT: Hopefully there's a ready to use library/component I can use and just tweak or configure instead of having to implement it from scratch. I know in the *nix world of two popular packages: god and monit.

You can create a Windows Service that just watches the current process list.

EnumProcesses provides the means of seeing processes running currently. There are many APIs available to start a new process, including:

  • system()
  • _exec()
  • WinExec()
  • ShellExecute()/ShellExecuteEx()
  • CreateProcess()
  • CreateProcessAsUser()
  • CreateProcessWithLogonW()

If you're using other languages/frameworks, they often provide their own wrappers around the above.

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