Sendkeys or sendmessage

daves1

Newcomer
Joined
Dec 2, 2003
Messages
11
Here at work, we are trying to automate software installations. We presently use Winbatch, but I want to use Visual Basic.net.

I just took my first course in VB.net and I really like it.

Can someone help me figure out how to send key strokes or send messages to screens that have input focus? This would enable me to automate some software installs that we received from vendors. Then we would not have to install them one at a time by hand. thanks in advance for your help.
 
have a search for sendKeys, this will show you how the function works. there are some really good examples of how to use the different things in the sendkeys function.

Good luck with it.
 
ok, here is the dead end of what u need:
1st declare this winapi function with constants in the header of the form as an example:
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Const KEYEVENTF_EXTENDEDKEY = &H1
Public Const KEYEVENTF_KEYUP = &H2

then whenever u want u can use it to automate keyboard strokes
like
keybd_event(CByte(System.Windows.Forms.Keys.A), 0, 0, 0)
keybd_event(CByte(System.Windows.Forms.Keys.B), 0, 0, 0)
keybd_event(CByte(System.Windows.Forms.Keys.E), 0, 0, 0)
to automate A, B, E
 
Thank you so much. Can you tell me how to tell if a certain window is up, so I can send the keystrokes to that particular window?? Thanks again.
 
It will take you ages to come up with something with 10% of the stuff that winbatch can do. We are in the same boat, but have 4 developers experienced in .net, but still use winbatch as it saves a shedload of work. If your doing it for other reasons (like to learn) then good luck, but from a business view its a lot of output for not much input, if you get my meaning.
 
OO I forgot to add. The best way to start is to get youself a programmng with API book (dan applemans book is a must) which has a complete section on controlling windows applications via the API.
 
I will get that book. Thanks for the help!!! I still want to use VB.net to automate software installs....
 
Back
Top