Solved

How to disable esc key

Posted on 1998-03-16
2
1,287 Views
Last Modified: 2013-12-03
My app has a modeless dialog box that needs to remain on the desktop as long as the app is running. However when I hit the 'Esc' key my dialog box goes away. How can I alter this behavior?
0
Comment
Question by:eejay
[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 4

Accepted Solution

by:
tflai earned 50 total points
ID: 1412081
BOOL CMyWnd::PreTranslateMessage(MSG* pMsg)
{
      if (pMsg->message == WM_KEYDOWN)
      {
            switch(pMsg->wParam)
            {
            case VK_ESC:
                  return TRUE;
            }
      }
      return CDialog::PreTranslateMessage(pMsg);
}
0
 

Author Comment

by:eejay
ID: 1412082
That works very nicely. Thanx.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Strange - Deleted Resource Info appears in Azure Portal 6 96
What is MicroStrategy.NET? 2 83
Problem to open text file 11 136
Need a simple RegEx to search for two words 27 87
This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 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