T
TC
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.
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.