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

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


How to override F10 Key default behaviour.

James P. Kelleghan -- jpk01@tag.acnet.net
Friday, January 10, 1997

Environment: Win 95, MSVC 4.0

Thanks to all of you that answered my request.

I include here a summary of the suggestions:

1.- Use SetWindowsHookEx() to change the default keyboard behaviour. 
This solution is harder to code, but is actualy the best suggestion in game
developement since it causes the least ammount of processingoerhead.

2.- Use PreProcessMessage() and test for WM_SYSKEYDOWN F10 key.
This solution is simple and elegant but adds unnecesary overhead by testing
for each message delivered to the window. Since games send multiple Mouse
and Timer messages, the test for every message causes the entire game loop
to slow down.

3.- Define an accelerator table for the F10 key.
Also a good suggestion but not easily incorporated into a generic class for
reuse in other game ports.

4.- Process OnSysKeyDown() for the F10 key.
Although this is the documented way to go, for reasons beyond my current
understanding, MFC does not pass the F10 SysKeyDown message to an SDI View
class, thus rendering the solution inoperable.

I hope this summary will prove useful to some of you out there.

Thanks again,

James


James P. Kelleghan
jkelleghan@usa.net
jpk01@tag.acnet.net
103245,1031@compuserve.com



=?iso-8859-1?Q?Fr=E9d=E9ric_Stepp=E9?=
Monday, January 13, 1997

> Environment: Win 95, MSVC 4.0
[...]=20
> 3.- Define an accelerator table for the F10 key.
> Also a good suggestion but not easily incorporated into a generic =
class for
> reuse in other game ports.
[...]
Sender: owner-mfc-l
Errors-To: owner-mfc-l
Precedence: bulk
Reply-To: mfc-l@netcom.com

Remember accelerator tables' definitions doesn't have to be stored as a =
resource.  You can easily create an accelerator table in a generic class =
without any reference to something outside your class implementation.

See ::CreateAcceleratorTable() and related functions for more =
information.

Frederic Steppe (frederic.steppe@infoboard.be)




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