Solved

What's the function call that closes a dialog window?

Posted on 2003-12-01
3
211 Views
Last Modified: 2013-11-20
void MyProgramDlg::OnBnClickedButtonClose()
{
}

Is there a function call like kill() or terminate() which will close the dialog window?
This question may sound stupid but the problem is that I could not find such function on MSDN....
Thanks!
0
Comment
Question by:UltimateApocalypse
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 20 total points
ID: 9850027
void MyProgramDlg::OnBnClickedButtonClose()
{
       CDialog::OnOK(); // or use  CDialog::OnCancel();
}

Rosh :)
0
 
LVL 11

Expert Comment

by:KurtVon
ID: 9850219
I don't think you can call the message handlers directly.  Some message handlers handle the original message, not the one for the handler you call, so Microsoft discourages it.

A better choice may be to call CDialog::EndDialog(nResult) which also allows you to specify any return value you want (nResult is the resturn value of DoModal().

Hope this helps.
0
 

Author Comment

by:UltimateApocalypse
ID: 9851840
Thanks, both answers work!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question