我正在尝试从另一个进程关闭单例事件句柄。流程资源管理器做到了这一点,我也希望能够实现这一点。我收到错误
(5,'DuplicateHandle','访问被拒绝。')
我是否传递了正确的参数?编辑:
window = win32gui.FindWindow(None, "Game")
pid = win32process.GetWindowThreadProcessId(window)
print(pid)
Proc = win32api.OpenProcess(1, True, pid[1])
Singleton = win32event.CreateEvent(None, 0, 0, "singletonEvent")
dup_handle = win32api.DuplicateHandle(Proc, Singleton, win32api.GetCurrentProcess(), 0, False, win32con.DUPLICATE_SAME_ACCESS)
dup_handle.Close()