/*TO DISPLAY A MESSAGE HAVING 3 BUTTONS YES,NO,CANCEL*/
#include<afxwin.h>
class myframe:public CFrameWnd
{
public:
myframe()
{
Create(0,"my mfc program");
}
OnRButtonDown()
{
int flag;
flag=MessageBox("good morning","haii..",MB_YESNOCANCEL);
switch(flag)
{
case IDYES:MessageBox("yes selected","haii");break;
case IDNO:MessageBox("no selected","haii");break;
case IDCANCEL:MessageBox("cancel selected","haii");break;
}
}
OnLButtonDown()
{
MessageBox("good evening","haii");
}
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDOWN()
END_MESSAGE_MAP()
class myapp:public CWinApp
{
public:
virtual BOOL InitInstance()
{
m_pMainWnd=new myframe();
m_pMainWnd->ShowWindow(1);
m_pMainWnd->UpdateWindow();
return TRUE;
}
A MessageBox
is a predefined dialog box that displays application-related
information to the user. Message boxes are also used to request
information from the user.
No comments:
Post a Comment