Structure of a Window Procedure

MRESULT EXPENTRY wpMain(HWND hWnd, ULONG ulMsg, MPARAM mp1, MPARAM mp2)
{
        switch (ulMsg)
               {
               case WM_CREATE:
                    WinDefWindowProc(hWnd, ulMsg, mp1, mp2);
                    <perform initialization of instance variables>
                    <define, create or establish access to data objects>
                    return((MRESULT)FALSE);
                    break;
               case WM_COMMAND:
                    <determine command by examining message parameters>
                    <perform processing for menu command>
                    return((MRESULT)0);
                    break;
               case WM_HELP:
                    <perform help processing>
                    return((MRESULT)0);
                    break;
                      :
                      :
               case WM_DESTROY:
                    <back out any incomplete updates>
                    <close all open data objects>
                    return((MRESULT)0);
                    break;
               default:
                    return((MRESULT)WinDefWindowProc(hWnd,
                                                     ulMsg,
                                                     mp1,
                                                     mp2));
                    break;
               }
}


[Back: Structure of an Application's Main Routine]
[Next: Structure of a Dialog Procedure]