473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Simulating keyboard input

Hi! I'm trying to write a background app that receives input from an external
device (through the comm port) and then sends that data to the active
foreground window that has focus. So far I have gotten this working using
the "keybd_event" function to send the data to the foreground window, but it
works for local apps only. When I RDP out to another machine and set focus
on a notepad session or command prompt window on the remote machine, the data
never makes it over. Any ideas?
Oct 20 '05 #1
2 1371
"jen2276" <je*****@discussions.microsoft.com> wrote in message
news:BE**********************************@microsof t.com...
Hi! I'm trying to write a background app that receives input from an
external
device (through the comm port) and then sends that data to the active
foreground window that has focus. So far I have gotten this working using
the "keybd_event" function to send the data to the foreground window, but
it
works for local apps only. When I RDP out to another machine and set
focus
on a notepad session or command prompt window on the remote machine, the
data
never makes it over.


You may want to take a look at SendInput().

Frankly, I have no idea if it works in the remote case but I think that it
exists to work around some of the limitations of keybd_event().

Regards,
Will
Oct 20 '05 #2
Thanks! SendInput combined with MapVirtualKey did the trick.

"William DePalo [MVP VC++]" wrote:
"jen2276" <je*****@discussions.microsoft.com> wrote in message
news:BE**********************************@microsof t.com...
Hi! I'm trying to write a background app that receives input from an
external
device (through the comm port) and then sends that data to the active
foreground window that has focus. So far I have gotten this working using
the "keybd_event" function to send the data to the foreground window, but
it
works for local apps only. When I RDP out to another machine and set
focus
on a notepad session or command prompt window on the remote machine, the
data
never makes it over.


You may want to take a look at SendInput().

Frankly, I have no idea if it works in the remote case but I think that it
exists to work around some of the limitations of keybd_event().

Regards,
Will

Oct 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: -z- | last post by:
I'm trying to make a prog that will type a character every x amount of seconds while running in the background. It needs to be like someone is at the keyboard punching it repeatedly. Is there a...
1
by: Barb | last post by:
I'm simulating keyboard input in Visual C++ using the SendInput function. It seems to work fine for all characters (A-Z, 0-9). I am however having real problems trying to read other characters such...
3
by: jimif_fr | last post by:
How is it possible to simulate the keyboard entries (and the mouse events) of one program, from another program. The first program is not written for this purpose and is a not aware of the...
0
by: Ray | last post by:
I have English Windows XP Pro and Office 2003 Pro on my computer. When I enter data into fields of tables, queries and forms of Access 2003, it automatically switches to Chinese keyboard input. ...
7
by: Don Riesbeck Jr. | last post by:
I'm working on an application (OEM) using C# that utilizes input from a keyboard, and USB Barcode Scanner. The scanner is a HID Keyboard device, and input from it is sent to the system as if it...
0
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as...
2
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as...
2
by: jen2276 | last post by:
Hi! I'm trying to write a background app that receives input from an external device (through the comm port) and then sends that data to the active foreground window that has focus. So far I have...
8
by: BD | last post by:
How can I duplicate the behavior of the operating system shortcut keys in my application? For example, my windows form has 5 controls (textboxes), the operating system will pickup which control...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.