Solved

How to Handle ESC button in PropertySheet?

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

635 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