Re: wm_keydown, wm_hotkey, or GetAsyncKeyState

Tech-Archive recommends: Speed Up your PC by fixing your registry



Yes, that is much better. I don't know if I can help but at least I think
the question is clear enough that someone can help.

Are you familiar with accelerator tables? They specify "hotkeys" like
system-wide hotkeys except they are specific to a window. I am not sure, but
I think accelerator tables are specific to windows, not an entire
application, but usually accelerator tables need to be specified for each
window and then nothing more or nothing much more needs to be done. You can
specify the command id that already corresponds to a meny item for an
accelerator key and then that could be all you need to do for the key. I say
key, but it is usually a combination of keys.


"dega" <dega@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7C4C20BF-8F69-4D5D-BAC6-1563B8BB6846@xxxxxxxxxxxxxxxx
ack, sorry, you're right.

here's an example of what i'm after:

i want the keypress of the letter 'p' to bring up a properties dialog for
something in my app, and i want ctrl+n to bring up an open file dialog.
how
do i capture these events globally across my app?

fyi. it's an mdi app if that makes any difference.

and again, i'd rather not have to explicitley trap these key presses in
every window/dialog in my app, and most importantly, if i use a solution
like
hotkeys, a keypress cannot interfere with another app.

hope this was more clear :)






"Sam Hobbs" wrote:

You need to be more clear in therms of requirements and less about
solutions. You have many details about how you might solve the problem
but
the problem is not clear.

Probably since you are unclear, I don't understand what you mean by
"fairly
common in big commercial apps", because my understanding of what you are
saying is something that is quite uncommon in big commercial
applications.


"dega" <dega@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A7FD862E-12A3-474F-AFDE-8E620B377F45@xxxxxxxxxxxxxxxx
i need to do something that's fairly common in big commercial apps i
see
today and that i to be able to capture a keypress in an app no matter
which
window/child window/control has focus.

i've found uses for each of these:

-wm_keydown for a key press specific to a particular window, obviously
captured in its respective wndproc

-wm_hotkey for system-wide capture for key presses

-GetAsyncKeyState for key presses in processes with heavy iterations
(ie.
game loops)

however, from my knowledge, none of these specifically address my
issue,
at
least not without presenting further problems:

wm_keydown: would work if i went and placed it in every single wndproc
in
my
app... all 50+ of them... ummm no.

GetAsyncKeyState: not working on the next WoW killer, just a business
app
and performance is a priority, so capturing this in my GetMessage loop
isn't
an option.

wm_hotkey: perhaps it's just my lack of knowledge of how this works,
but
if
i register a key press/key combo that is the same as another apps (ie.
ctrl+f5 ala visual studio) and i'm in vs and press this key combo, it
may
fire my hotkey instead of vs's... same with single keys, register the
letter
'a' and someone's letter to their grndm (grandma) will be short a few
vowels... and i'm not about to throw usability out the window.

so what is the proper way to do this without losing my sanity? :)









.



Relevant Pages

  • Re: Steve Carroll does not know the difference between saving and quitting.
    ... or in an app where it can be used for additional work it ... Most apps cannot be used with no window open... ... yet it does not quit. ... And nor should it Snit! ...
    (comp.sys.mac.advocacy)
  • Re: Steve Carroll does not know the difference between saving and quitting.
    ... or in an app where it can be used for additional work it ... Most apps cannot be used with no window open... ... yet it does not quit. ... And nor should it Snit! ...
    (comp.sys.mac.advocacy)
  • Re: wm_keydown, wm_hotkey, or GetAsyncKeyState
    ... today and that i to be able to capture a keypress in an app no matter ... i register a key press/key combo that is the same as another apps (ie. ... and i'm not about to throw usability out the window. ...
    (microsoft.public.win32.programmer.ui)
  • SetCapture, mouse and key events
    ... turns on drawing, and the second mouse click turns it off. ... Capture property would make sure the window gets all mouse messages until ... I'm just experimenting with this app; ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: display array in a frame wnd
    ... An SDI app, where the image is displayed in the view. ... There would never be a need to create a frame window; ... I better prefered to reuse display provided with the librairy opencv, ...
    (microsoft.public.vc.mfc)