Solved

How to Handle ESC button in PropertySheet?

Posted on 2001-07-16
2
706 Views
Last Modified: 2013-11-20
In my application  I have a modless PropertySheet with 3 PropertPages added to it.
In the ProprtySheet (not Property Page), I have added my own Close button which closes the dialog on clicking on it.
In the event handling of this Close button, I am calling :  
CPropertysheet::OnClose() function, which closes the dialog. Also I am handling WM_CLOSE message.
In trying to solve the problem, I also tried handling WM_KEYDOWN, WM_SYSKEYDOWN and WM_DESTROY.

But when I press ESC from the keyboard, the PropertySheet
dialog does not close. Where as for ather dialogs it works fine even if WM_CLOSE is not handled.

How should the PropertySheet dialog automatically get closed when I press ESC button from the keyboard?
0
Comment
Question by:pratimag
[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 3

Accepted Solution

by:
_mb_ earned 50 total points
ID: 6288640
You can try to override the PreTranslateMessage() member:

BOOL CYourPropSheet::PreTranslateMessage(MSG* pMsg)
{
    if( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE )
    {
        CPropertysheet::OnClose()
        return TRUE;
    }
       
    return CPropertySheet::PreTranslateMessage(pMsg);
}
0
 

Author Comment

by:pratimag
ID: 6288675
Thanks, even i was trying out on the same lines. The comment was real good one.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 146
fizzArray2 challenge 1 112
Unix Command -- Challenging  question 7 106
Message not shown 5 105
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 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