Solved

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

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 162
ORA-01403: no data found 43 99
How to determine file rename from EventLog ? 2 49
Smart Camera scanning and reading information 3 106
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

786 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