15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


VC++ 4.0 / NT 3.51 - Trapping 'default usage' Keys

Roger Longren -- rlongren@execpc.com
Tuesday, April 02, 1996

Part of my MFC application creates a terminal emulation window 
as an MDI child.  Because I want to provide user control of the 
emulation keys, I need to prevent most of the default keyboard 
actions from occurring.

Although my main application uses context sensitive help, I need 
to prevent the default F1 and shift/F1 action when the terminal 
emulation window has focus.  Other "default action" keys are 
also a problem, such as alt/F4, F10, etc.

Can anyone help guide me to a proper method of gaining complete 
control over these keystrokes?  Remember, I want the default 
action at all times other than when a specific MDI child has 
focus.

Thanks in advance for any help.
Roger Longren




Greg D. Tighe -- gdt@eng.aisinc.com
Thursday, April 04, 1996

[Mini-digest: 2 responses]

> Can anyone help guide me to a proper method of gaining complete 
> control over these keystrokes?  Remember, I want the default 
> action at all times other than when a specific MDI child has 
> focus.
> 
> Thanks in advance for any help.
> Roger Longren
> 
Override PreTranslateMessage() in your terminal view class.  You can 
look for WM_KEYDOWN messages and process the ones you want.  If you 
do process a keystroke message and don't want the default behavior, 
return TRUE.  For all other messages return FALSE to get the default 
behavior.

	-Greg Tighe
	Applied Intelligent Systems, Inc.
	Ann Arbor, MI
	gdt@aisinc.com
-----From: Dan Kirby 

Roger, you need to trap the message before the message gets translated 
(before the TranslateAccelerators and TranslateMessage calls).  You can do 
this in MFC by overriding the PreTranslateMessage function of your 
CMDIChildWnd.

--dan




| Вернуться в корень Архива |