如何查看 Windows 上是否正在运行另一个进程? [英] How do I see if another process is running on windows?

查看:27
本文介绍了如何查看 Windows 上是否正在运行另一个进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 VC++ 控制台应用程序,我需要检查是否有另一个进程正在运行.我没有窗口标题,我只有可执行文件名称.我如何获得它的进程句柄/PID?我可以枚举使用此 .exe 运行的进程吗?

I have a VC++ console app and I need to check to see if another process is running. I don't have the window title, all I have is the executable name. How do I get the process handle / PID for it? Can I enumerate the processes running with this .exe ?

推荐答案

您可以使用 EnumProcesses 枚举系统上的进程.

You can use EnumProcesses to enumerate the processes on a system.

您需要使用 OpenProcess 来获取进程句柄,然后 QueryFullProcessImageName 以获得可执行的进程.

You'll need to use OpenProcess to get a process handle, then QueryFullProcessImageName to get the processes executable.

这篇关于如何查看 Windows 上是否正在运行另一个进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆