6/25/10

Model dialog box(MFC)

Buzz It
#include_afxwin.h_ //replace"_"with"<>"
#include_afxdlgs.h_
#include"resource.h"
class EDialog:public CDialog
{
public:
EDialog (int n):CDialog (n)
{
}
int OnInitDialog ()
{
CDialog ::OnInitDialog ();
return TRUE;
}

};
class myframe:public CFrameWnd
{
public:
myframe()
{
Create(0,"modal dbox",WS_OVERLAPPEDWINDOW,rectDefault,0,MAKEINTRESOURCE(IDR_MENU1));
}
void fun(int id)
{
EDialog eg(IDD_DIALOG1);
eg.DoModal();
}
DECLARE_MESSAGE_MAP();
};
BEGIN_MESSAGE_MAP(myframe, CFrameWnd)
ON_COMMAND(100,fun)
END_MESSAGE_MAP()
class myapp:public CWinApp
{
public:
int InitInstance()
{
myframe *p;
p=new myframe;
p->ShowWindow(3);
m_pMainWnd=p;
return 1;
}
};
myapp a;


Output