473,770 Members | 2,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Emulating keyboard strokes in vb.net

Hello,

I need to emulate keyboard strokes from a console application. The
console application monitors a textfile and when something is matched
in a text file I need the matched string outputted to the keyboard as
if someone was typing on the keyboard. can someone help me locate the
correct vb.net function to use?

Thanks!

Jun 13 '06 #1
3 5655
Have a look at:

SendKeys.Send
SendKeys.SendWa it

They do what you want.

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Paulers" <Su*******@gmai l.com> schreef in bericht
news:11******** **************@ h76g2000cwa.goo glegroups.com.. .
Hello,

I need to emulate keyboard strokes from a console application. The
console application monitors a textfile and when something is matched
in a text file I need the matched string outputted to the keyboard as
if someone was typing on the keyboard. can someone help me locate the
correct vb.net function to use?

Thanks!

Jun 13 '06 #2
Thanks for the response but can I use those functions from a console
application? Or does it have to be a form applicaton?

Peter Proost wrote:
Have a look at:

SendKeys.Send
SendKeys.SendWa it

They do what you want.

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Paulers" <Su*******@gmai l.com> schreef in bericht
news:11******** **************@ h76g2000cwa.goo glegroups.com.. .
Hello,

I need to emulate keyboard strokes from a console application. The
console application monitors a textfile and when something is matched
in a text file I need the matched string outputted to the keyboard as
if someone was typing on the keyboard. can someone help me locate the
correct vb.net function to use?

Thanks!


Jun 13 '06 #3
I'm sorry sendkeys indeed can't be used with a console app, I read your OP
to quick.
But can't you use Console.WriteLi ne("The matched part")
Something like this quick sample I made, it just keeps checking c:\test.txt
until it finds some text in it and the outputs it to the console if the text
is found

Sub Main()
Console.WriteLi ne("Hello I'm waiting for text in c:\test.txt")
Do While checkFile() = False
Threading.Threa d.CurrentThread .Sleep(1000)
Loop
End Sub

Private Function checkFile() As Boolean
Dim strMessage As String
Dim myReader As New FileStream("c:\ test.txt", FileMode.Open,
FileAccess.Read )
Dim myStreamReader As New StreamReader(my Reader)
strMessage = myStreamReader. ReadToEnd()
myStreamReader. Close()
myReader.Close( )
If strMessage = "" Then
Return False
Else
Console.WriteLi ne(strMessage)
Console.ReadLin e()
Return True
End If
End Function
Hope this helps,

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Paulers" <Su*******@gmai l.com> schreef in bericht
news:11******** **************@ c74g2000cwc.goo glegroups.com.. .
Thanks for the response but can I use those functions from a console
application? Or does it have to be a form applicaton?

Peter Proost wrote:
Have a look at:

SendKeys.Send
SendKeys.SendWa it

They do what you want.

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Paulers" <Su*******@gmai l.com> schreef in bericht
news:11******** **************@ h76g2000cwa.goo glegroups.com.. .
Hello,

I need to emulate keyboard strokes from a console application. The
console application monitors a textfile and when something is matched
in a text file I need the matched string outputted to the keyboard as
if someone was typing on the keyboard. can someone help me locate the
correct vb.net function to use?

Thanks!

Jun 14 '06 #4

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

Similar topics

0
2348
by: magician | last post by:
hi can any one suggest a way to utilize the keyboard to control an animation for example in a space invaders game. when a key is pressed and hed at the moment, there is one movement and then a pause before the 'repeat' of the key is acted upon to move the animation further. I know this is a windows setting to stop multiple key strokes... but is there any way around this in code in vb?
4
32950
by: Ralf Toender | last post by:
Hi! Does anybody know how to send a keystroke C#? In C++ it's done by: keybd_event ( ... ) or SendInput ( ... ). What namespace does include this counterpart? Thanks Ralf
6
4958
by: Al Bahr | last post by:
H I need to combine Ink strokes with the background image into a bit map. Would appreciate any help Thank A
0
1426
by: CForrester | last post by:
Hey there, I'm trying to emulate a joystick throttle using keyboard keys. For example: ` = 0%, 1 = 10%, 2 = 20%, 3 = 30%, 4 = 40%, 5 = 50%, 6 = 60%, 7 = 70%, 8 = 80%, 9 = 90%, 0 = 100% My question is... How do I send joystick commands to Windows from VB.NET? Specifically, throttle commands (A throttle is just an axis, right?).
1
5454
by: Jacek Jurkowski | last post by:
If You enter "osk" into a commad box of Your windows You will bring On screen keyboard. I must wrote my own version and I'm asking about some how to... How to send a key strokes not to active aplication (which is keyboard itself) but to the Windows and otjer applications like osk does? Im runing my kayboard as an separate thread using backround worker and i would like keystrokes to be handled by parent app...
1
3741
by: zanthor | last post by:
Ok... so call me crazy, but I have an idea and I'm looking for where to start... I want to write an application that catches keystrokes and then either redirects them to the in focus window or another window based on some simple rules... in some cases the keystrokes would need to be sent out to multiple windows. I've done part of this in the past using a C++ application to hook the Win32 keyboard API and dispose of unwanted keystrokes...
5
7509
by: mattmao | last post by:
Hello everyone, I am studying the programming language C from the scratches, so my question might be too simple for you guys: How would you clear your previous keyboard strokes while let the program still run? I did some research online, and yeah, some guy said, just use the fflush(stdin); But, it kills everything in the keyboard buffer(excuse me if my understanding is wrong), which is not what I want.
11
13212
by: vbguy2008 | last post by:
Hi, I am coding a Windows Form Application in VB.NET 2008. I would like to clear the keyboard buffer or at least empty all outstanding key presses queued up for my application at certain points in my program. I looked at System.Console.Read, but that doesn't seems appropriate. I also looked into EnableWindow Lib "user32". I ran into a problem where I could disable the form, but was unable to enable the form. The code is:
8
2742
by: Ron Eggler | last post by:
Hi, I would like to get the time of the most recent human activity like a cursor movement or a key hit. Does anyone know how I can get this back to start some action after there has been no activity for X minutes/seconds? Thank you! -- chEErs roN
0
9439
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
10237
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
10017
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
8905
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
7431
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
6690
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
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3589
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.