Solved

How to Handle ESC button in PropertySheet?

Posted on 2001-07-16
2
682 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 122
wordcount challenge 11 101
Is there a simple front-end menu system. 9 69
x-bar in Google Sheets 2 24
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

947 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

22 Experts available now in Live!

Get 1:1 Help Now