Newsgroups: comp.windows.misc,comp.windows Path: 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 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.