This example shows a typical dialog procedure that has both an OK and a Cancel button. If the user selects the OK button, WinDismissDlg is called with a result value of TRUE. If the user selects the Cancel button, WinDismissDlg is called with a result value of FALSE.

#define INCL_WINDIALOGS   /* Window Dialog Mgr Functions  */
#define  ID_ENTER  101;
#define  ID_CANCEL 102;
#include <os2.h>

MPARAM   mpParam1;
HWND    hwnd;

case WM_COMMAND:
     switch (SHORT1FROMMP(mpParam1))
     {
       /* OK button selected */
       case ID_ENTER:
            WinDismissDlg(hwnd, TRUE);
            return (0L);

       /* Cancel button selected */
       case ID_CANCEL:
            WinDismissDlg(hwnd, FALSE);
            return (0L);
     }


[Back] [Next]