/* dlgbasedapp.cpp   App's window is a simple dialog box */

#include <windows.h>
#include "resource.h"

BOOL CALLBACK DialogProc (HWND hDlg, UINT wMessage, 
                                        WPARAM wParam, LPARAM lParam) ;

int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, 
                                        LPSTR lpszCmdLine, int nCmdShow)
{
        // Start the dialog box
        DialogBox (hInstance, "FIRSTDIALOG", NULL, (DLGPROC)DialogProc) ;
        return 0 ;  // Exit
}

/* Dialog box message processing function. */

BOOL CALLBACK DialogProc (HWND hDlg, UINT wMessage, 
                                        WPARAM wParam, LPARAM lParam)
{
    switch (wMessage)       /* process messages */
    {
        case WM_INITDIALOG:
            return (TRUE) ;
        case WM_COMMAND:    /* controls in dialog box activated */
            switch (LOWORD(wParam))
            {
                case IDC_OK:                /* OK button */
                    EndDialog (hDlg, 0) ;   /* exit the dialog box */
                    return (TRUE) ;
                case IDC_NOTOK:             /* Not OK button */
                    MessageBeep (0) ;       /* just beep */
                    return (TRUE) ;   
            }
            break ;
    }
    return (FALSE) ;    /* return FALSE to signify message not processed */
}