Thanks for you reply. Actually, I created one MFC Application using the Template, and its SDI. So, it creates list of files, Doc, View, etc. For View, i select the base class as CView (in the wizard itself). I removed the default created menu and included my menu list. Now, i added a simple dialog, and for that, I created a class also derived from CDialog. Following are the .h and .cpp file contents .h file
class CSelectOptionsDlg : public CDialog
{
public:
CSelectOptionsDlg(CWnd* pParent = NULL);
virtual BOOL OnInitDialog();
public:
enum {IDD = IDD_SELECTOPTIONSDLG};
public:
void OnOkClicked();
DECLARE\_MESSAGE\_MAP()
};
.cpp
CSelectOptionsDlg::CSelectOptionsDlg(CWnd* pParent)
: CDialog(CSelectOptionsDlg::IDD, pParent)
{
}
BEGIN_MESSAGE_MAP(CSelectOptionsDlg, CDialog)
ON\_COMMAND(IDOK, OnOkClicked)
END_MESSAGE_MAP()
void CSelectOptionsDlg::OnOkClicked()
{
AfxMessageBox("Ok clicked");
EndDialog(1);
}
BOOL CSelectOptionsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
return TRUE;
}
As I mentioned earlier, if i add this line in OnDraw, its drawing on the first time only,
pDC->TextOut(20, 20, L"test sdi", 10);
Also, in MainFrm.cpp file,
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_CREATE()
ON_COMMAND(ID_START, OnStartPlan )
ON_COMMAND(ID_STOP, OnStopPlan )
ON_COMMAND(ID_SELECTOPTIONS, OnSelectOption )
ON_COMMAND(ID_EXIT, OnExit )
END_MESSAGE_MAP()
void CMainFrame::OnSelectOption()
{
CSelectOptionsDlg cSODlg;
cSODlg.DoModal();
}
doing like this. OnDraw is not calling everytime. What I need is, whenever i click ok and close the dialog, OnDraw need to be called. How can i do that? Any help. Thanks.