Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Closing a Dialog Window

Posted on 2004-10-27
2
Medium Priority
?
292 Views
Last Modified: 2013-11-20
I would like to close my dialog window from button code. I can see that EndDialog() is probaby the routine to call but it wants a "handle" to the dialog window.  How can I get this from my code.  It doesn't seem to be passed in.

Thanks for any help.
Steve
0
Comment
Question by:steva
[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
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 600 total points
ID: 12428570
If you are working with a MFC CDialog derived class, you don't need a handle. Just call EndDialog(IDOK).
It is the CDialog::EndDialog function member: http://msdn.microsoft.com/library/en-us/vclib/html/_mfc_cdialog.3a3a.enddialog.asp
The unique argument is a result value, could be any integer value you want, but I recommend you to use IDOK constant to simulate an "OK" pressure.
0
 

Author Comment

by:steva
ID: 12429092
Ok, that works fine.  I was looking at the EndDialog() for Windows Management, that returns a BOOL and takes a HWND parameter.  Apparently when you're in a Dialog button routine you default to the EndDialog() you pointed to rather than the one I was looking at.

Thanks,
Steve
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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: 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 …
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

597 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