[python-win32] IsHungAppWindow or equivalent

Tim Golden mail at timgolden.me.uk
Mon Apr 14 21:09:36 CEST 2008


Dahlstrom, Roger wrote:
 > Yeah - I see the MSDN page and the HWND parameter.
 > I tried the following data types: C_short, c_ushort, c_int, c_uint,
 > c_long, c_ulong, c_longlong, c_ulonglong.

ctypes includes a handy wintypes subpackage:

from ctypes import wintypes
print wintype.HWND

So, in principle:

<code>
import win32gui
import ctypes
from ctypes.wintypes import HWND

IsHungAppWindow = ctypes.windll.user32.IsHungAppWindow

def callback (hwnd, *args):
   if IsHungAppWindow (HWND (hwnd)):
     print win32gui.GetWindowText (hwnd)

win32gui.EnumWindows (callback, None)

</code>

TJG


More information about the python-win32 mailing list