This is an EXPERIMENTAL patch. It could break existing
One major change is that the default message handler is
no longer called always as the HookMessage help page
tells you. This is required sometimes (when handling
WM_GETMINMAXINFO for example). In those cases use
something like this:
res = self.WindowProc(message, wParam, lParam).
Another change is that now the value returned by your
Python handler will be passed back to Windows. So
please return an integer (usually 0) as required by the
specific message you handle. Not returning an integer
still works, through.
Added pResult parameter to Python_check_message in
which it puts the handler return value.
Made old CPythonWndFramework::WindowProc a special case
of a new one which now dispatches messages to the
Python handlers and deletes associations on WM_NCDESTROY.
Disabled message hooking in HookWindowsMessages and
message processing in Win32uiPreTranslateMessage.
PyCWnd::DoKillAssoc now checks if the window was
already detached before calling UnsubclassWindow. For
an unknown reason this is necessary after the changes
Added PyCWnd.WindowProc method which calls the
underlying MFC one.
Fixed Python_OnCmdMsg to not call the command handler
if pHandlerInfo != NULL.