作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
有没有一种方法可以在不需要库的情况下使用 Python 检查 Windows 上是否存在 PID?怎么办?
最佳答案
用一小杯 WINAPI 就可以解决这个问题。
def pid_running(pid):
import ctypes
kernel32 = ctypes.windll.kernel32
SYNCHRONIZE = 0x100000
process = kernel32.OpenProcess(SYNCHRONIZE, 0, pid)
if process != 0:
kernel32.CloseHandle(process)
return True
else:
return False
关于python - 使用 Python 检查 Windows 上是否存在 PID 而无需库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17620833/
我是一名优秀的程序员,十分优秀!