Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a output wich acts like typing on my keyboard?

Status
Not open for further replies.

henry906

Computer
Dec 16, 2006
2
Hi,

Can anyone help me with creating a output wich acts like typing on my keyboard?
I'm no advanced VB user, so I couldn't find out on my own.

Henry906
 
Replies continue below

Recommended for you

You could use the Form_KeyPress event. You will need to set the Forms Keypreview property to True

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

Steam Engine enthusiasts:
 
Also search for 'SendKeys' in the help docs or on Google. I have not used it myself, but it sounds like what you are after.

Here is a snippet from the msdn library (VB6):
Code:
SendKeys Statement

Sends one or more keystrokes to the active window as if typed at the keyboard.

Syntax

SendKeys string[, wait]
 
cowski

SendKeys is usually used within your VB app to generate keypresses in an external app. Have a look at the instructive SendKeys example in VBHelp which shows how to send simulated keypresses to Calc.exe

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

Steam Engine enthusiasts:
 
It isn't immediately clear to me from the original post where Henry wants to send the output. Depending on the need 'keypress' or 'sendkeys' may be appropriate.

Henry, a little more information will help us help you. What is it you are trying to accomplish? Are you trying to catch keystrokes or send keystrokes to your own program or an external program?

Also, I should clarify a little; I have fiddled with sendkeys example code but I have not had a need for it in one of my own programs.
 
my idea was:
a user should type a text like "a sample text"
then press start and the program would send the text over and over , like ctrl + v, but for programs in which that is inpossible, so it would be for external programs, i think that SendKeys will help me a lot

Henry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor