Structure of a Dialog Procedure

MRESULT EXPENTRY dpDProc(HWND hWnd, ULONG ulMsg, MPARAM mp1, MPARAM mp2)
{
        switch (ulMsg)
               {
               case WM_INITDLG:
                    <extract initialization data from message parameters>
                    <establish initial values for control window data>
                    return((MRESULT)TRUE);
                    break;
               case WM_CONTROL:
                    <determine originator of message and message contents>
                    <perform control-specific processing>
                    return((MRESULT)0);
                    break;
               case WM_COMMAND:
                    switch LOUSHORT(mp1):
                           {
                           case DID_OK:
                                <complete dialog>
                                WinDismissDlg(hWnd,TRUE);
                                break;
                           case DID_CANCEL:
                                <cancel dialog>
                                WinDismissDlg(hWnd,FALSE);
                                break;
                           }
                    return((MRESULT)0);
                    break;
               default:
                    return((MRESULT)WinDefDlgProc(hWnd,
                                                  ulMsg,
                                                  mp1,
                                                  mp2));
                    break;
               }
}


[Back: Structure of a Window Procedure]
[Next: Allocating Memory in Previous Versions of OS/2]