Click to See Complete Forum and Search --> : Modal dialog with keyboard accelerators?
flyingcowofdoom
December 16th, 2004, 01:35 PM
Hi,
I have a program that is a DLL. The program has a modal dialog window, but I want to be able to use keyboard accelerators. I do not use MFC, and the program has no message loop. Is there a way to accomplish this?
TIA,
Chris
NoHero
December 16th, 2004, 02:05 PM
As far as I know: No. Because you have to call TranslateAccelerator (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardaccelerators/keyboardacceleratorreference/keyboardacceleratorfunctions/translateaccelerator.asp) in your main loop.
But I can think of different ways: Why not using 'RegisterHotkey' to emulate this function? And/or handle WM_KEYDOWN and call the appropiate function with this information? ...
flyingcowofdoom
December 22nd, 2004, 09:37 AM
Well, I found a way. It doesn't use accelerators, but it accomplishes the same thing. I registered a global hot key using RegisterHotKey() when I create the dialog, then unregister the hot keys when my dialog is closed.
NoHero
December 22nd, 2004, 09:40 AM
Yes. As you can see in my last post, I suggested this. :wave:
flyingcowofdoom
December 22nd, 2004, 10:28 AM
Right...I used your suggestion, thank you for it. When I said I found a way, I meant that I found a way to use your idea.
--FCOD
NoHero
December 22nd, 2004, 10:45 AM
Right...I used your suggestion, thank you for it. When I said I found a way, I meant that I found a way to use your idea.
--FCOD
Ok. I was in hurry when I posted this suggestion. It was no idea, because I know that it works, but I didn't had enough time to post a code example.
You are very welcome
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.