Cursor application.

  • Thread starter Thread starter tc
  • Start date Start date
T

tc

Hi all.

I have a need to collect COM data on a WM5 device and 'throw' the data at
the current cursor, regardless of application or field position. Anyone
have a sample or a head start?

I know there are data wedge utils for bar codes scanners, but this is data
direct from a com port and I need to interrogate it first.

I'm ok with the com port code and I'm already capturing the data without
problems.

Thanks.
 
You can use keybd_event (P/Invoke from Managed code) to place characters in
the keyboard input. e.g.

[DllImport("coredll.dll")]
private static extern void keybd_event(byte vk, byte scan, int flags, int
extraInfo);

Peter
 
This looks like what I need, although a thorough search has only pulled up a
couple of examples for VB2003 PC code. I need something for the CF, WM5.

If someone could kindly show an example of how to send a single character to
the cursor, in VB Net CF, for WM5 I'd be fine from there.

Many thanks.


Peter Foot said:
You can use keybd_event (P/Invoke from Managed code) to place characters
in the keyboard input. e.g.

[DllImport("coredll.dll")]
private static extern void keybd_event(byte vk, byte scan, int flags, int
extraInfo);

Peter

--
Peter Foot
Microsoft Device Application Development MVP
www.peterfoot.net | www.inthehand.com
In The Hand Ltd - .NET Solutions for Mobility

tc said:
Hi all.

I have a need to collect COM data on a WM5 device and 'throw' the data at
the current cursor, regardless of application or field position. Anyone
have a sample or a head start?

I know there are data wedge utils for bar codes scanners, but this is
data direct from a com port and I need to interrogate it first.

I'm ok with the com port code and I'm already capturing the data without
problems.

Thanks.
 
keybd_event() doesn't exist on the PC, so any example you found was for
Windows CE. Use it.

Paul T.

tc said:
This looks like what I need, although a thorough search has only pulled up
a couple of examples for VB2003 PC code. I need something for the CF,
WM5.

If someone could kindly show an example of how to send a single character
to the cursor, in VB Net CF, for WM5 I'd be fine from there.

Many thanks.


Peter Foot said:
You can use keybd_event (P/Invoke from Managed code) to place characters
in the keyboard input. e.g.

[DllImport("coredll.dll")]
private static extern void keybd_event(byte vk, byte scan, int flags, int
extraInfo);

Peter

--
Peter Foot
Microsoft Device Application Development MVP
www.peterfoot.net | www.inthehand.com
In The Hand Ltd - .NET Solutions for Mobility

tc said:
Hi all.

I have a need to collect COM data on a WM5 device and 'throw' the data
at the current cursor, regardless of application or field position.
Anyone have a sample or a head start?

I know there are data wedge utils for bar codes scanners, but this is
data direct from a com port and I need to interrogate it first.

I'm ok with the com port code and I'm already capturing the data without
problems.

Thanks.
 
tc pisze:
This looks like what I need, although a thorough search has only pulled up a
couple of examples for VB2003 PC code. I need something for the CF, WM5.

If someone could kindly show an example of how to send a single character to
the cursor, in VB Net CF, for WM5 I'd be fine from there.

public static void SendKey(byte key)
{
const int KEYEVENTF_KEYUP = 0x02;
const int KEYEVENTF_KEYDOWN = 0x00;
const int KEYEVENTF_SILENT = 0x04;
keybd_event(key, 0, KEYEVENTF_KEYDOWN , 0);
keybd_event(key, 0, KEYEVENTF_KEYUP , 0);

}
[DllImport("coredll.dll", SetLastError = true)]
private static extern void keybd_event(byte bVk, byte bScan, int
dwFlags, int dwExtraInfo);

and

string tekst = "ZWYKLYKODEAN13";

foreach (byte znak in tekst)
{
SendKey(znak);
}
 
Many thanks.

The data coming in is all basic keyboard data, so in the end I had to create
a char array and convert this to a byte array and send the data one chr at a
time. But I've got it working great now.

Thanks for everyone's input.
Very much appreciated.

Adam said:
tc pisze:
This looks like what I need, although a thorough search has only pulled
up a couple of examples for VB2003 PC code. I need something for the CF,
WM5.

If someone could kindly show an example of how to send a single character
to the cursor, in VB Net CF, for WM5 I'd be fine from there.

public static void SendKey(byte key)
{
const int KEYEVENTF_KEYUP = 0x02;
const int KEYEVENTF_KEYDOWN = 0x00;
const int KEYEVENTF_SILENT = 0x04;
keybd_event(key, 0, KEYEVENTF_KEYDOWN , 0);
keybd_event(key, 0, KEYEVENTF_KEYUP , 0);

}
[DllImport("coredll.dll", SetLastError = true)]
private static extern void keybd_event(byte bVk, byte bScan, int dwFlags,
int dwExtraInfo);

and

string tekst = "ZWYKLYKODEAN13";

foreach (byte znak in tekst)
{
SendKey(znak);
}
 
Back
Top