-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi,
I am trying to use SetWindowsHookExA via ctypes to be notified when Windows are mapped/unmapped, to get the same functionality as SUBSTRUCTURE_MASK events on the root X-window (or is there a better way that I have missed?) Here is the code: WIN_HOOK = CFUNCTYPE(c_long, c_int, c_uint, c_long) def register_hook() WH_CALLWNDPROCRET = 4 dll_handle = ctypes.windll.user32._handle self.call_next_hook = ctypes.windll.user32.CallNextHookEx self.hook_handle = types.windll.user32.SetWindowsHookExA(WH_CALLWNDPROCRET, WIN_HOOK(window_hook), dll_handle, 0) def window_hook(self, nCode, wParam, lParam): print "hello" return self.call_next_hook(self.hook_handle, nCode, wParam, lParam) Something with the callback signature must be wrong because the hook does get registered (hook_handle>0), but as soon as a window event fires, my application is terminated. It does not even get to say hello... Here's what I used to figure out the C method signature: http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx Apologies if this is not the right list (please let me know which one is), it definitely looks like people here are most likely to be able to help me. Thanks Antoine -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREKAAYFAkqyipIACgkQGK2zHPGK1rsYnACfSmX8S99kF0JZbvjRAeFSMAGU hIMAniBF8mbW3/9xbhSU3zD0c+xluf/p =rWxJ -----END PGP SIGNATURE----- _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32