Article View: borland.public.cppbuilder.nativeapi
Article #12716Re: Simulating that a key has been pressed
From: Remy Lebeau (TeamB)
Date: Sat, 22 Nov 2003 23:37
Date: Sat, 22 Nov 2003 23:37
26 lines
1921 bytes
1921 bytes
"Feico" <feicorem0veth1s@gmx.net> wrote in message news:2llvrv8g0ethuqm7b21760f21944k4qppp@4ax.com... > I have been searching for some time to a method to make another window > believe that a key has been pressed. Send the window WM_KEYUP/DOWN and/or WM_CHAR messages. Alternatively look at keybd_event(), although it is not quite as reliable as messages, unless you don't care which window gets the keystrokes. > The first parameter could be HWND_BROADCAST or HWND_TOPMOST. It can also be the HWND for the specific window that you are actually interested in. > Well, the function does not return zero, so it reports that it has > succeeded. But whatever I tried, nothing seems to happen, and the > foreground window receives no input. What EXACTLY are you trying to accomplish? If you are interested in sending messages to the foreground window only, whatever it is, you should be using GetForegroundWindow(), not HWND_TOPMOST. Gambit
Technical Details
Message-ID:
<3fbff23d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<2llvrv8g0ethuqm7b21760f21944k4qppp@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,c26082be79ed8ef8,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-11-22 15:39:20 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <2llvrv8g0ethuqm7b21760f21944k4qppp@4ax.com> Subject: Re: Simulating that a key has been pressed Date: Sat, 22 Nov 2003 15:37:14 -0800 Lines: 28 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 67.22.137.149 Message-ID: <3fbff23d$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1069543997 67.22.137.149 (22 Nov 2003 15:33:17 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail