win32process.GetWindowThreadProcessId
returning [0, 0]
when ctypes.windll.user32.GetWindowThreadProcessId
works fine
#2457
Labels
Expected behavior and actual behavior
I've found a case where
pywin32
fails to get a process ID whenctypes
manages.I've been running this code for 6+ years and have never seen it happen before, so I'm afraid the only way I know how to reproduce this is with Helldivers 2.
Passing the window handle of Helldivers 2 to
win32process.GetWindowThreadProcessId
to get its process ID will return[0, 0]
, but withctypes.windll.user32.GetWindowThreadProcessId
it returns the correct process ID.For any other process these two values are always the same.
Steps to reproduce the problem
win32process.GetWindowThreadProcessId
For the sake of linking issues, I created huntfx/MouseTracks#65 on my own project before finding that the
ctypes
method worked.System information
Python version and distribution:
Python 3.7.9
Python 3.11.8
pywin32 version:
300
for 3.7308
for 3.11Windows Version:
10.0.19045 Build 19045
DLL locations:
C:\Users\Peter\AppData\Roaming\Python\Python311\site-packages\pywin32_system32\pywintypes311.dll
C:\Users\Peter\AppData\Roaming\Python\Python311\site-packages\pywin32_system32\pythoncom311.dll
The text was updated successfully, but these errors were encountered: