[python-win32] Can't catch WM_CREATE

Jack Andrews effbiae at ivorykite.com
Wed Apr 20 12:02:59 CEST 2005


hi,

i can't seem to catch a WM_CREATE message in simple code.
i expect my code to print 'create', but it doesn't

listing follows.

tia,  jack


from win32api       import *
from win32gui       import *
from win32con       import *

wc = WNDCLASS()
hi = wc.hInstance = GetModuleHandle(None)
wc.lpszClassName = nm = "name"
wc.style=0
wc.hCursor=LoadCursor(0,IDC_ARROW)
wc.hbrBackground = COLOR_WINDOW
def create(hwnd, msg, wparam, lparam):   print 'create'
def destroy(hwnd, msg, wparam, lparam):  print 'destroy';PostQuitMessage(0)
wc.lpfnWndProc={WM_CREATE:create,WM_DESTROY:destroy}
cl=RegisterClass(wc)
hwnd=CreateWindow(cl,nm,WS_OVERLAPPEDWINDOW,0,0,
                  CW_USEDEFAULT,CW_USEDEFAULT,0,0,hi,None)
ShowWindow(hwnd)
UpdateWindow(hwnd)
PumpMessages()


More information about the Python-win32 mailing list