Solved

Disable hotkeys.

Posted on 1998-09-30
1
426 Views
Last Modified: 2013-11-20
I have a CEdit control in a toolbar that i want to write
into, the problem is that i have the 1-5 keys at hotkeys for some functions.

My question is if there is any good way to disable this hotkeys when im writing the text in the control?
0
Comment
Question by:DanielC
1 Comment
 

Accepted Solution

by:
umarama earned 0 total points
Comment Utility
In your derived CEdit class, say CMyEdit, add an handler for PreTranslateMessage ...

From Class Wizard derive a new class (say CMyEdit) from CEdit.
Add the following handler

BOOL CMyEdit::PreTranslateMessage(MSG* pMsg)
{
  if ((pMsg->message == WM_KEYDOWN)
{
     if ( (pMsg->wParam >=  VK_NUMPAD1) &&  (pMsg->wParam <=  VK_NUMPAD5))
      return TRUE;

// Above was for Number Pad keys
// If you need this for 1-5 top panel keys check for range 1 to 5.
// If function keys check for VK_F1 to VK_F5
// U should return TRUE if it falls in range.
 }
  return CEdit::PreTranslateMessage(pMsg);
}
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

744 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

16 Experts available now in Live!

Get 1:1 Help Now