Article View: borland.public.cppbuilder.nativeapi
Article #15195Re: Keybd_event problems
From: Henry
Date: Fri, 18 Jul 2003 11:01
Date: Fri, 18 Jul 2003 11:01
38 lines
2105 bytes
2105 bytes
Thank you very very much (my problem is now solved)!
Henry
"JD" <nospam@nospam.com> ha scritto nel messaggio
news:3f17c5c8$1@newsgroups.borland.com...
>
> "Henry" <eangelo@libero.it> wrote:
> > I am trying to programmatically generate keyboard strokes
> > [...] My problem is: if I try to generate characters other
> > then "A-Z" and "0-9", the "keyboard_event" does not work
> > correctly. The following code:
> >
> > keybd_event('+', 0, 0, 0);
> > keybd_event('+', 0, KEYEVENTF_KEYUP, 0);
> >
> >does not work.
>
> I just used an OnKeyDown event to catch the '+' keypress.
> Turns out that when your code executes, the Key value is 43
> but if you manually press the plus symbol the Key value is 107.
>
> If you replace '+' with 107, your code performs as expected.
> You should note that according to the win32 docs, the first
> parameter is a virtual key value and that:
>
> 43 = 0010 1011
> 107 = 0110 1011
>
> So ....
>
> keybd_event( '+' | 0x40, 0, 0, 0);
> keybd_event( '+' | 0x40, 0, KEYEVENTF_KEYUP, 0);
>
> also produces the desired results.
>
> ~ JD
>
Technical Details
Message-ID:
<3f17d37e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f17a276@newsgroups.borland.com> <3f17c5c8$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,f99436c531b1645c X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-18 04:09:15 PST Reply-To: "Henry" <eangelo@libero.it> From: "Henry" <eangelo@libero.it> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f17a276@newsgroups.borland.com> <3f17c5c8$1@newsgroups.borland.com> Subject: Re: Keybd_event problems Date: Fri, 18 Jul 2003 13:01:11 +0200 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 212.38.42.61 Message-ID: <3f17d37e@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1058526078 212.38.42.61 (18 Jul 2003 04:01:18 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail