def find_current_steam_game_pid():
"""
find current play game process id with GameOverlayUI.exe
if not find return -1
"""
target_pid = -1
for proc in psutil.process_iter():
try:
if proc.name() == 'GameOverlayUI.exe':
cmds = proc.cmdline()
for index, arg in enumerate(cmds):
if arg == '-pid':
target_pid = int(cmds[index+1])
break
break
except psutil.AccessDenied:
print("Permission error or access denied on process")
return target_pid
评论列表
文章目录