MFC Question:
Download Questions PDF

Visual Programming c++ coding for create a paint application?

Answer:

class myframe:public CFrameWnd
{
public:
myframe()
{
Create(NULL,"My Paint application");
}
void OnPaint()
{
CPaintDC d(this);
CBrush mybrush(RGB(0,255,0));
d.SelectObject(&mybrush);
d.Rectangle(50,150,150,50);
}
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
class myapp:public CWinApp
{
public:
int InitInstance()
{
myframe *p=new myframe;
p->ShowWindow(1);
m_pMainWnd=p;
return 1;
}
};
myapp a;

Download MFC Interview Questions And Answers PDF

Previous QuestionNext Question
Which Macro is a Super set of other two macro DECLARE_SERIAL, DECLARE_DYNAMIC and DECLARE_DYNCREATE?What is the use of CCmdTarget?