PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework Use of keybd_event for some characters

Reply

Use of keybd_event for some characters

 
Thread Tools Rate Thread
Old 13-09-2006, 04:59 PM   #1
=?Utf-8?B?S2V2ZW4gQ29yYXp6YQ==?=
Guest
 
Posts: n/a
Default Use of keybd_event for some characters


Hi,

I'm using keybd_event to simulate the keyboard. I'm not able to simulate
some characters like , ? _ =

I've tried in many way but I'm not able to find the combination to get this
result.

Looking to windows virtual keyboard I've tried this lines of code:

keybd_event(0x10, 0, 0, true); // shift down
keybd_event((byte)Keys.Divide, 0, 0, true); // divide down
keybd_event((byte)Keys.Divide, 0, 2, true); // divide up
keybd_event(0x10, 0, 2, true); // shift up

This because the ? character appears, over the button /, when you press
Shift button.

I did the same job, with success, for the characters over the number (D0,
D1, ...). The example below generate the character ) that is exactly the
character over 0.

keybd_event(0x10, 0, 0, true); // shift down
keybd_event((byte)Keys.D0, 0, 0, true); // 0 down
keybd_event((byte)Keys.D0, 0, 2, true); // 0 up
keybd_event(0x10, 0, 2, true); // shift up

What can I do to simulate the character ? and the others ?

Thank you in advance for your help.

Keven Corazza






  Reply With Quote
Old 13-09-2006, 05:06 PM   #2
Guest
 
Posts: n/a
Default Re: Use of keybd_event for some characters

You should probably be using PostKeybdMessage, not keybd_event


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



"Keven Corazza" <KevenCorazza@discussions.microsoft.com> wrote in message
news:E2ECB4FF-885F-4CDB-A477-64DCA7FAE92E@microsoft.com...
> Hi,
>
> I'm using keybd_event to simulate the keyboard. I'm not able to simulate
> some characters like , ? _ =
>
> I've tried in many way but I'm not able to find the combination to get
> this
> result.
>
> Looking to windows virtual keyboard I've tried this lines of code:
>
> keybd_event(0x10, 0, 0, true); // shift down
> keybd_event((byte)Keys.Divide, 0, 0, true); // divide down
> keybd_event((byte)Keys.Divide, 0, 2, true); // divide up
> keybd_event(0x10, 0, 2, true); // shift up
>
> This because the ? character appears, over the button /, when you press
> Shift button.
>
> I did the same job, with success, for the characters over the number (D0,
> D1, ...). The example below generate the character ) that is exactly the
> character over 0.
>
> keybd_event(0x10, 0, 0, true); // shift down
> keybd_event((byte)Keys.D0, 0, 0, true); // 0 down
> keybd_event((byte)Keys.D0, 0, 2, true); // 0 up
> keybd_event(0x10, 0, 2, true); // shift up
>
> What can I do to simulate the character ? and the others ?
>
> Thank you in advance for your help.
>
> Keven Corazza
>
>
>
>
>
>



  Reply With Quote
Old 13-09-2006, 05:27 PM   #3
Fabien
Guest
 
Posts: n/a
Default Re: Use of keybd_event for some characters

Hi,

Check this, you have the virtual key codes :
http://msdn.microsoft.com/library/d...ualKeyCodes.asp

BR


Fabien Decret
Windows Embedded Consultant

ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/




<ctacke/> a écrit :

> You should probably be using PostKeybdMessage, not keybd_event
>
>
> --
> Chris Tacke
> OpenNETCF Consulting
> Managed Code in the Embedded World
> www.opennetcf.com
> --
>
>
>
> "Keven Corazza" <KevenCorazza@discussions.microsoft.com> wrote in message
> news:E2ECB4FF-885F-4CDB-A477-64DCA7FAE92E@microsoft.com...
> > Hi,
> >
> > I'm using keybd_event to simulate the keyboard. I'm not able to simulate
> > some characters like , ? _ =
> >
> > I've tried in many way but I'm not able to find the combination to get
> > this
> > result.
> >
> > Looking to windows virtual keyboard I've tried this lines of code:
> >
> > keybd_event(0x10, 0, 0, true); // shift down
> > keybd_event((byte)Keys.Divide, 0, 0, true); // divide down
> > keybd_event((byte)Keys.Divide, 0, 2, true); // divide up
> > keybd_event(0x10, 0, 2, true); // shift up
> >
> > This because the ? character appears, over the button /, when you press
> > Shift button.
> >
> > I did the same job, with success, for the characters over the number (D0,
> > D1, ...). The example below generate the character ) that is exactly the
> > character over 0.
> >
> > keybd_event(0x10, 0, 0, true); // shift down
> > keybd_event((byte)Keys.D0, 0, 0, true); // 0 down
> > keybd_event((byte)Keys.D0, 0, 2, true); // 0 up
> > keybd_event(0x10, 0, 2, true); // shift up
> >
> > What can I do to simulate the character ? and the others ?
> >
> > Thank you in advance for your help.
> >
> > Keven Corazza
> >
> >
> >
> >
> >
> >


  Reply With Quote
Old 18-09-2006, 07:37 PM   #4
Paul G. Tobey [eMVP]
Guest
 
Posts: n/a
Default Re: Use of keybd_event for some characters

Printable characters should be posted using PostKeybdEvent(). Unprintable
characters should use keybd_event(). That's the logic I used in my
'wedging' applications.

Paul T.

"Keven Corazza" <KevenCorazza@discussions.microsoft.com> wrote in message
news:E2ECB4FF-885F-4CDB-A477-64DCA7FAE92E@microsoft.com...
> Hi,
>
> I'm using keybd_event to simulate the keyboard. I'm not able to simulate
> some characters like , ? _ =
>
> I've tried in many way but I'm not able to find the combination to get
> this
> result.
>
> Looking to windows virtual keyboard I've tried this lines of code:
>
> keybd_event(0x10, 0, 0, true); // shift down
> keybd_event((byte)Keys.Divide, 0, 0, true); // divide down
> keybd_event((byte)Keys.Divide, 0, 2, true); // divide up
> keybd_event(0x10, 0, 2, true); // shift up
>
> This because the ? character appears, over the button /, when you press
> Shift button.
>
> I did the same job, with success, for the characters over the number (D0,
> D1, ...). The example below generate the character ) that is exactly the
> character over 0.
>
> keybd_event(0x10, 0, 0, true); // shift down
> keybd_event((byte)Keys.D0, 0, 0, true); // 0 down
> keybd_event((byte)Keys.D0, 0, 2, true); // 0 up
> keybd_event(0x10, 0, 2, true); // shift up
>
> What can I do to simulate the character ? and the others ?
>
> Thank you in advance for your help.
>
> Keven Corazza
>
>
>
>
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off