Solved

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

Posted on 2003-12-01
3
205 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now