| | |
Make It Select Different Things
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
You'll want to look into the "sendkeys" command. This command allows you to send keystrokes to applications (shift-end, ctrl-c, ctrl-v). Keep in mind, sendkeys only sends keystrokes to the currently active (foreground) window. So, you'll want to make whatever window you want to mess with the foreground first, with either appactivate, or the setforegroundwindow (and setactivewindow) api calls. If you want to get more complicated than that (say, cross-task subclassing) you are going to want to be very... very careful.
•
•
Join Date: Apr 2006
Posts: 25
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Comatose
You'll want to look into the "sendkeys" command. This command allows you to send keystrokes to applications (shift-end, ctrl-c, ctrl-v). Keep in mind, sendkeys only sends keystrokes to the currently active (foreground) window. So, you'll want to make whatever window you want to mess with the foreground first, with either appactivate, or the setforegroundwindow (and setactivewindow) api calls. If you want to get more complicated than that (say, cross-task subclassing) you are going to want to be very... very careful.
Sendkeys is usually not a great idea.... because there are a ton of problems that can occur. What if the user switches focus (or what if there is spyware or some other junk that spawns new windows for the hell of it), while your program is in the midst of sending keys..... all hell can break loose. Read up on this thread, and check out this page: http://www.daniweb.com/techtalkforums/post127770.html
http://www.scriptlogic.com/Kixtart/h...s/sendkeys.htm
http://www.scriptlogic.com/Kixtart/h...s/sendkeys.htm
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Form_Load() Shell "c:\windows\notepad.exe", vbNormalFocus Me.Show AppActivate "Untitled - Notepad" SendKeys "This Is A Test!" SendKeys "+{HOME}" End Sub
•
•
Join Date: Apr 2006
Posts: 25
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Comatose
Sendkeys is usually not a great idea.... because there are a ton of problems that can occur. What if the user switches focus (or what if there is spyware or some other junk that spawns new windows for the hell of it), while your program is in the midst of sending keys..... all hell can break loose. Read up on this thread, and check out this page: http://www.daniweb.com/techtalkforums/post127770.html
http://www.scriptlogic.com/Kixtart/h...s/sendkeys.htm
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Form_Load() Shell "c:\windows\notepad.exe", vbNormalFocus Me.Show AppActivate "Untitled - Notepad" SendKeys "This Is A Test!" SendKeys "+{HOME}" End Sub
If Send Keys are a bad idea, what you you do to click on the buttons that need to be clicked in this program.
Well, generally it's a poor idea to try to automate a program that isn't made to be automated. Excel for example, let's you create an object in it's name, and work with it's properties and methods. Trying to force yourself on a program that doesn't expect it, can lead to crappy results. That's all I'm saying.... sendkeys may well be your only option, unless you dig into something like findwindow, and findwindowEX api calls, and then use the sendmessage API.... but findwindow and findwindowex can produce some flakey results when trying to find a specific child window...... stick with sendkeys, but just know that what you are doing is Taboo.
![]() |
Similar Threads
- Tutorial: Understanding ASP classes (ASP)
- i need help to select command (Oracle)
- select statemt LIKE (MySQL)
- Installing Salvaged drive, doesn't see the drive (Storage)
- www.themexp.org not working????? (Web Browsers)
- keep xp running smooth (Windows tips 'n' tweaks)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Opening An Adobe File In Vb6
- Next Thread: tabledef in ado
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






