Article View: comp.windows.misc
Article #518Re: Activating a button with a key
From: Paul Bonneau
Date: Wed, 20 Mar 1991 18:30
Date: Wed, 20 Mar 1991 18:30
19 lines
1258 bytes
1258 bytes
In article <1097300009@cdp> jeff@cdp.UUCP writes: > >I'm trying to figure out how to "stuff keystrokes" into Windows. >I've been able to successfully do this for edit controls, using >the obvious "send WM_CHAR" or "send WM_KEYDOWN, WM_KEYUP" sequences. >However, I'm stuck on how to activate a button by pressing a key. >I know this is possible, since the Recorder can do it with no >problem, but no matter where I send messages, nothing happens. >I've tried SPYing but that hasn't revealed any useful info. > Try PostMessage() instead of send. This way WM_KEYDOWN and WM_KEYUP messages will get translated by the call to TranslateMessage() inside the message loop of the recipient. Message that are sent (SendMessage()) do not go to the application's message queue, and so do not get processed by TranslateMessage(). cheers - Paul Bonneau.
Technical Details
Message-ID:
<1991Mar20.183039.12254@hyper.hyper.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!hyper.hyper.com!bonneauReferences:
<1097300009@cdp>Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.misc,comp.windows Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!hyper.hyper.com!bonneau From: bonneau@hyper.hyper.com (Paul Bonneau) Subject: Re: Activating a button with a key Message-ID: <1991Mar20.183039.12254@hyper.hyper.com> Reply-To: bonneau@hyper.UUCP (Paul Bonneau,,) Organization: HyperCube Inc. References: <1097300009@cdp> Date: Wed, 20 Mar 1991 18:30:39 GMT