MFC Dialog Example

/////////////////////////////////////////////////////////////////////////////
//
// //Microsoft Developer Studio generated resource script.
//
/*
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 90
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
END
*/
/////////////////////////////////////////////////////////////////////////////

#define IDD_DIALOG1 101
#include <afxwin.h>
class CDialogMainApp : public CWinApp
{
public:
virtual BOOL InitInstance();
DECLARE_MESSAGE_MAP()
};

class CDialogMain : public CDialog
{
public:
CDialogMain(); // standard constructor
protected:
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
};


BOOL CDialogMainApp::InitInstance()
{
CDialogMain dlg;
m_pMainWnd = &dlg;
dlg.DoModal();
return FALSE;
}

CDialogMain::CDialogMain()
: CDialog(IDD_DIALOG1 , NULL)
{
}

BEGIN_MESSAGE_MAP(CDialogMainApp, CWinApp)
END_MESSAGE_MAP()

BEGIN_MESSAGE_MAP(CDialogMain, CDialog)
ON_WM_PAINT()
END_MESSAGE_MAP()

BOOL CDialogMain::OnInitDialog()
{
return TRUE;
}

CDialogMainApp theApp;