This procedure dispatches application defined event handlers and alternately executes default process for both standard or sub/super classed windows.

Map is defined as follows. In most cases I define this table in .data, but in can be in .const also. I choose writeable memory as application can redefine characteristics.

MWMap dd 0 ; Address of sub or super class default proc dw (MWEnd - MWMap - 6) / 6 ; Determine number of messages in map dw WM_DESTROY dd QuitApp dw WM_CREATE dd CMainWnd MWEnd equ $

Entry point of windows procedure requires only two instructions

MWndProc proc mov esi, offset MWMap ; Point to message map for this window jmp ScanMap MWndProc endp

By whatever means you choose to intialize WNDCLASSEX then entry point need only be specified as the 3 parameter

Wc WNDCLASSEX < 30h, CS_HREDRAW or CS_VREDRAW, MWndProc, 0, 0,\ 0, 0, 0, COLOR_APPWORKSPACE + 1, NULL, AppName, 0>

Here is an example of the actual handler