I am trying to code a program to send keys to a certain window.

For example, in notepad I want the program to write "test" over and over again, in the notepad window. However, I do not want this window to be an active window. Is it possible to make it send keys through a background method?

I hope you understand what I mean, i have trouble explaining it:(

7 Years
Discussion Span
Last Post by marketingmaniac

set the forms visible property to false
call the forms .focus method
then use the send keys command it should allow you to
send keys to an invisible form. or call the process using the process class and focus to the process example notepad.exe you might need to get the window handle first. then send keys. I would simply write to a textbox field in a form and send the results to a txt file using streamwriter class.


any time you call "" send key "" the user will know,, it will take control of your

best do what jdsurgeon said and write to a text file and update that text file without bothering the user by taking control of their keyboard.

does this answer your question or do you need to know how to set focus on the text file? then send a key ?


I ad the idea of a game automation program. Which clicked keys at a certain time but without it being the active window:(


you probably can do this with code but the hard thing will be trying to figure
out what command to send because its a game, you can try to use software such as
network monitors, process monitors to dissasemble or see whats being sent as far
as commands but i think that might be alittle out of the scope.

other then that,, you can still do this if you need to by ubot studio and or imacro
but it will take command over the console and keyboard and have to have focus on the game.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.