473,406 Members | 2,378 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,406 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 1372
"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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.