473,800 Members | 2,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

writing a keyboard wedge

Hi

Can someone point me the good direction to start a project that injects
keycodes, or (scancodes ) into the system as if the came from the keyboard.
(like barcodescanners etc.. do)

Johan
Dec 7 '06 #1
5 7415
Hello Sagaert,

Use SendMessage WinAPI function
http://www.pinvoke.net/default.aspx/...ndMessage.html

SJHi
SJ>
SJCan someone point me the good direction to start a project that
SJinjects keycodes, or (scancodes ) into the system as if the came
SJfrom the keyboard. (like barcodescanners etc.. do)
SJ>
SJJohan
SJ>
---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Dec 7 '06 #2
Michael Nemtsev <ne*****@msn.co mwrote:
>S Johan wrote:
SJCan someone point me the good direction to start a project that
SJinjects keycodes, or (scancodes ) into the system as if the came
SJfrom the keyboard. (like barcodescanners etc.. do)
Use SendMessage WinAPI function
http://www.pinvoke.net/default.aspx/...ndMessage.html
I think that normally SendMessage isn't the best way. It's too
targetted and specific, e.g. knowing precisely which window to send
the message to.

SendInput is better. This is a low-level call to "spoof" mouse-clicks
and keyboard presses. I don't know if there's a managed wrapper; I'd
use p-invoke.

Here's an example win32/c++ program I wrote which intercepts the right
alt key, and spoofs a right-mouse-click in response. It shows how I
used SendInput.
http://www.wischik.com/lu/Programmer/Keymouse

--
Lucian
Dec 7 '06 #3
Michael,

This is actually not what you want to do, as it doesn't simulate input
from devices (keyboard, mice, etc, etc).

The OP really wants the SendInput API function that will produce
keyboard input.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Michael Nemtsev" <ne*****@msn.co mwrote in message
news:17******** *************** ****@msnews.mic rosoft.com...
Hello Sagaert,

Use SendMessage WinAPI function
http://www.pinvoke.net/default.aspx/...ndMessage.html

SJHi
SJSJCan someone point me the good direction to start a project that
SJinjects keycodes, or (scancodes ) into the system as if the came
SJfrom the keyboard. (like barcodescanners etc.. do)
SJSJJohan
SJ---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche


Dec 7 '06 #4
On Thu, 7 Dec 2006 19:33:24 +0100, "Sagaert Johan"
<RE************ *@hotmail.comwr ote:
>Hi

Can someone point me the good direction to start a project that injects
keycodes, or (scancodes ) into the system as if the came from the keyboard.
(like barcodescanners etc.. do)

Johan
As well as the other suggestions, SendKeys.Send() might be useful for
you. The online help does include a caution however: "If your
application is intended for international use with a variety of
keyboards, the use of Send() could yield unpredictable results and
should be avoided."
rossum

Dec 7 '06 #5
Thanks ,

I will have a look at it, seems in the direction of my needs.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote in
message news:Or******** ******@TK2MSFTN GP05.phx.gbl...
Michael,

This is actually not what you want to do, as it doesn't simulate input
from devices (keyboard, mice, etc, etc).

The OP really wants the SendInput API function that will produce
keyboard input.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Michael Nemtsev" <ne*****@msn.co mwrote in message
news:17******** *************** ****@msnews.mic rosoft.com...
Hello Sagaert,

Use SendMessage WinAPI function
http://www.pinvoke.net/default.aspx/...ndMessage.html

SJHi
SJSJCan someone point me the good direction to start a project that
SJinjects keycodes, or (scancodes ) into the system as if the came
SJfrom the keyboard. (like barcodescanners etc.. do)
SJSJJohan
SJ---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche


Dec 8 '06 #6

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

Similar topics

7
10697
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 were a keyboard. I need to be able to identify input from the scanner and keyboard independently. I've looked at DirectX.DirectInput, and using user32.dll to hook into the keyboard messages, but neither method seems to allow for identification of...
2
4071
by: Dan | last post by:
I have an application that uses a COM port barcode scanner. This uses a listener to notify the application when a barcode has been scanned. The application now needs to be modified to use a Human Interface Device scanner. This means I need to read in the barcode from the keyboard input and notify the same listeners. This seemed relativly easy until I went looking for the keyboard input stream. Does anyone know where it is? (bearing in mind...
6
1544
by: samslists | last post by:
Hi... I want to write a program that will let me know after thirty minutes of typing that I need to take a five minute typing break. But when I stop typing it's smart enough to pause the 30 minute timer automatically. This is under the X-Window System (Linux). The tricky part is obviously knowing when the mouse and keyboard are being used....especially when my application doesn't have the focus.
1
2755
by: NvrBst | last post by:
I'd like to simulate keypresses at the lowest level I can (writing to the keyboard buffer if possible). I can find x86 solutions but nothing for a higher level language. Does anyone know how I can do this in C#? I'm also wondering if the "keybd_event" or "SendInput" goes as low as writing to the Keyboard Controller Buffer? or do they use messaging? - I think they both use messaging but just wanted to make sure.
4
3400
by: Chris Lasher | last post by:
Is there a way to interact with keyboard LEDs (for Caps/Scroll/Num Lock) in Python? I'd like to achieve an effect similar to the *NIX command "setleds -L", but I'm not sure where to start, but I figured someone out there would have an idea or maybe experience with something similar. Thanks very much in advance for your help! Chris
3
5235
by: muthursyamburi | last post by:
Hello All, I'm really looking for a help in reading/writing the keyboard buffer in AIX (IBM Unix). In DOS, there is some memory addres (I remember it as 0x417) from where the keyboard buffer starts. But I need the same in AIX. My requirement is this. In AIX, we need to change the password every 60 days or so. And while changing, it wont accept the previous 4 passwords we used. But when you change to a new one, its difficult to remember the...
2
3460
by: tomwilliams | last post by:
Hi I have created a website which has a number of buttons on it which allow users to add items to there basket, they then click on an AJAX watermarked textbox to set focus before using a keyboard wedge scanner to scan there staff ID card, this causes a postback and validates the user - all works perfectly. My problem is caused if the user attempts to scan their card before clicking on the watermarked textbox. This then forces a postback...
2
4795
by: pesobol | last post by:
I am using a wedge barcode scanner to enter data in an access database, but for certain combinations of characters I want to parse the input in code and react accordingly. The keypress event on the form only gives me access to the first character in the string, is there some way to access the keyboard buffer during the keypress event and get the rest of the string? The only way I have found to do this is write the data to a field on the...
0
1251
by: xahlee | last post by:
Here's a little tutorial that lets you write emacs commands for processing the current text selection in emacs in your favorite lang. Elisp Wrapper For Perl Scripts http://xahlee.org/emacs/elisp_perl_wrapper.html plain text version follows. ------------------------------------- Elisp Wrapper For Perl Scripts
0
9550
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10501
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10250
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7574
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.