To associate a window procedure with a window class, an application must pass a pointer to that window procedure to the WinRegisterClass function. Once an application has registered the window procedure, the procedure automatically is associated with each new window created with that class.
The following code fragment shows how to associate the window procedure in the previous example with a window class:
HAB hab; CHAR szClientClass[] = "My Window Class"; WinRegisterClass(hab, /* Anchor-block handle */ szClientClass, /* Class name */ ClientWndProc, /* Pointer to procedure */ CS_SIZEREDRAW, /* Class style */ 0); /* Window data */