Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / March 2008

Tip: Looking for answers? Try searching our database.

keybd_event !

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TC - 06 Mar 2008 16:15 GMT
Hi all, hope someone can help here.  I have a couple of problems with the
keybd_event routine in VB.Net for a portable application, either PPC2003 or
WM5, the results are the same.  The following code takes a text string (dat)
and sends the output to the cursor.

Dim byt As Byte() = StrToByteArray(dat)
For t As Integer = 0 To UBound(byt)
keybd_event(byt(t), 0, 0, 0)
Next

Public Function StrToByteArray(ByVal str As String) As Byte()
Dim s As Char()
s = str.ToCharArray
Dim b(s.Length - 1) As Byte
For i As Integer = 0 To s.Length - 1
b(i) = Convert.ToByte(s(i))
Next
s = Nothing
Return b
End Function

The problems are as follows:
1.  I want the option of forcing upper case, but the keyboard setting on the
portable over-rides my string convertion, if the portable keyboard is in
lower case I only ever get lower case chars.
2.  I want to be able to 'replace' characters in the original data string,
but I can only do this if I replace with Upper case characters, for example
if I replace 5 with T it works, if I replace 5 with t, the string is shown
without any char where 5 is.

I assume there are loads of different settings for keyb_event(byt, x, x, x),
can anyone point me to a list of x's, or have any ideas?

Cheers.
TC - 06 Mar 2008 16:38 GMT
Having thought about this for a few, I think the problem is fundamentaly
with the keybd_event, this is obviously sending data to the keyboard, so the
CAPS state and all the rest of the problems seem to be coming in.

So, I suppose what I really need is code to throw characters directly at the
cursor and remove the keyboard from the whole process.

Anyone have any sample code for this in VB.Net for the PPC2003 or MW5
platform?

> Hi all, hope someone can help here.  I have a couple of problems with the
> keybd_event routine in VB.Net for a portable application, either PPC2003
[quoted text clipped - 30 lines]
>
> Cheers.
TC - 06 Mar 2008 17:19 GMT
I've also noticed something else that I just can't understand.  Using the
code in the first post, if I send 123456 I get 123456.  If I send 111123456
I get 123456.  Same subsequent characters are being missed.  This simply
wont do!

Any help on this subject would be very much appreciated.

> Hi all, hope someone can help here.  I have a couple of problems with the
> keybd_event routine in VB.Net for a portable application, either PPC2003
[quoted text clipped - 30 lines]
>
> Cheers.
Family Tree Mike - 07 Mar 2008 03:44 GMT
> I've also noticed something else that I just can't understand.  Using the
> code in the first post, if I send 123456 I get 123456.  If I send 111123456
[quoted text clipped - 37 lines]
> >
> > Cheers.

I'm not familiar with keybd_event, so I googled it and MSDN.  Have you seen
the article that says it is superseded by SendInput()?

From MSDN:
keybd_event Function
The keybd_event function synthesizes a keystroke. The system can use such a
synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message. The
keyboard driver's interrupt handler calls the keybd_event function.

Windows NT/2000/XP/Vista:This function has been superseded. Use SendInput
instead.
TC - 07 Mar 2008 08:19 GMT
Yeah, I've looked all over, SendInput doesn't appear to be available on the
portable, or if it is, information for the VB programmer is pretty much non
existent.

>> I've also noticed something else that I just can't understand.  Using the
>> code in the first post, if I send 123456 I get 123456.  If I send
[quoted text clipped - 60 lines]
> Windows NT/2000/XP/Vista:This function has been superseded. Use SendInput
> instead.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.