// DelayMsgBoxDemoDlg.cpp : implementation file
#define new DEBUG_NEW
// CDelayMsgBoxDemoDlg dialog
CDelayMsgBoxDemoDlg::CDelayMsgBoxDemoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDelayMsgBoxDemoDlg::IDD, pParent)
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
void CDelayMsgBoxDemoDlg::DoDataExchange(CDataExchange* pDX)
DDX_Text(pDX, IDC_EDIT1, m_text);
DDX_Text(pDX, IDC_EDIT2, m_delay);
DDV_MinMaxUInt(pDX, m_delay, 0, 120);
DDX_Check(pDX, IDC_CHECK1, m_close);
DDX_Check(pDX, IDC_CHECK2, m_showicon);
DDX_Radio(pDX, IDC_RADIO1, m_icon);
// CDelayMsgBoxDemoDlg message handlers
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
CDelayMessageBox::MBIcon mbicon = CDelayMessageBox::MBIcon::MBICONNONE;
mbicon = CDelayMessageBox::MBIcon::MBICONINFORMATION;
mbicon = CDelayMessageBox::MBIcon::MBICONEXCLAMATION;
mbicon = CDelayMessageBox::MBIcon::MBICONSTOP;
mbicon = CDelayMessageBox::MBIcon::MBICONQUESTION;
You may use either of the classes.
In behaviour they are identical.
It's in the implementation that they differ.
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Nish is a real nice guy who has been writing code since 1990 when he first got his hands on an 8088 with 640 KB RAM. Originally from sunny Trivandrum in India, he has been living in various places over the past few years and often thinks it’s time he settled down somewhere.
Nish has been a Microsoft Visual C++ MVP since October, 2002 - awfully nice of Microsoft, he thinks. He maintains an MVP tips and tricks web site - www.voidnish.com
where you can find a consolidated list of his articles, writings and ideas on VC++, MFC, .NET and C++/CLI. Oh, and you might want to check out his blog on C++/CLI, MFC, .NET and a lot of other stuff - blog.voidnish.com
Nish loves reading Science Fiction, P G Wodehouse and Agatha Christie, and also fancies himself to be a decent writer of sorts. He has authored a romantic comedy Summer Love and Some more Cricket
as well as a programming book – Extending MFC applications with the .NET Framework
Nish's latest book C++/CLI in Action
published by Manning Publications is now available for purchase. You can read more about the book on his blog.
Despite his wife's attempts to get him into cooking, his best effort so far has been a badly done omelette. Some day, he hopes to be a good cook, and to cook a tasty dinner for his wife.