calling python function from windowproc in win32
Gabor Papp
rod at inf.bme.hu
Fri Mar 24 07:18:02 EST 2000
I'm trying to call a python function back from a win32 windowproc.
I pass a hwnd of a Toplevel window to a C initalization function
from python. I hook my own windowproc to the existing window
like this:
pWndProc = SetWindowLong( hwnd, GWL_WNDPROC, (long)(WNDPROC)MyWindowProc
);
my windowproc looks something like this:
LRESULT CALLBACK MyWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lParam )
{
if(uMsg == WM_COMMAND)
{
PyObject_CallFunction( myCallback, NULL );
return 0;
}
return CallWindowProc( pWndProc, hwnd, uMsg, wParam, lParam );
}
This callback cause a page fault in python15.dll, but it works fine if
I call this from a normal C function and not a windowproc. I suspect
some thread problems.
Thanks for your help,
Gabor Papp
More information about the Python-list
mailing list