daves1 Posted December 9, 2003 Posted December 9, 2003 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. Quote
wildfire1982 Posted December 9, 2003 Posted December 9, 2003 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. Quote Chris
daves1 Posted December 9, 2003 Author Posted December 9, 2003 Do you mean the search in the VB.net help library, or where should I search. thanks much Quote
fadi Posted December 9, 2003 Posted December 9, 2003 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 Quote
daves1 Posted December 9, 2003 Author Posted December 9, 2003 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. Quote
Grimfort Posted December 9, 2003 Posted December 9, 2003 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. Quote
Grimfort Posted December 9, 2003 Posted December 9, 2003 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. Quote
daves1 Posted December 9, 2003 Author Posted December 9, 2003 I will get that book. Thanks for the help!!! I still want to use VB.net to automate software installs.... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.