by Jessy Butzke (11 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 9th August 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Control other programs from your program. You can activate other program buttons and menus by using the SendKeys function. This example will
'HERE IS A LIST OF KEYS
'Backspace {BS}
'Break {BREAK}
'Caps Lock {CAPSLOCK}
'DELETE {DEL}
'Down Arrow {DOWN}
'END {END}
'ENTER {ENTER} or ~
'Escape {ESC}
'Help {HELP}
'Home {HOME}
'Insert {INS}
'Left Arrow {LEFT}
'Num Lock {NUMLOCK}
'Page Down {PGDN}
'Page Up {PGUP}
'Print Screen {PRTSC}
'Right Arrow {RIGHT}
'Scroll Lock {SCROLLLOCK}
'Tab {TAB}
'Up arrow {UP}
'F1 - F16 {F1} - {F16}
'Shift +
'Ctrl ^
'Alt %
Private Sub Command1_Click()
'This is to tab from button to button or space in notepad
AppActivate "Untitled - Notepad" 'You would use any programs top handle for example, the handle for
SendKeys "{TAB}" 'calc.exe is Calculator
End Sub
Private Sub Command2_Click()
'This is to drop down a line in notepad or to activate a button on a program
AppActivate "Untitled - Notepad" 'You would use any programs top handle for example, the handle for
SendKeys "{ENTER}" 'calc.exe is Calculator
End Sub
Private Sub Command3_Click()
'This is to close that program
AppActivate "Untitled - Notepad" 'You would use any programs top handle for example, the handle for
SendKeys "%{F4}" 'Sometimes it will ask if you are sure you want to close
'if it did you would enter.
'appactivate "Untitled - Notepad"
'SendKeys "%{F4}"
'Appactivate "Untitled - Notepad"
'Sendkeys "%{Y}"
End Sub
Private Sub Command4_Click()
'Sends what you typed into notepad
Dim strPart As String
strPart$ = Me.Text1.Text$
If Trim(strPart$) <> "" Then 'Checks text1.text for any words
Else
MsgBox "You did not enter anything.", vbCritical, "Error"
Me.Text1.SetFocus
End If
Do Until strPart$ = "" 'Loops until strPart$ is blank
AppActivate "Untitled - Notepad"
SendKeys Left(strPart$, 1)
strPart$ = Right(strPart$, Len(strPart$) - 1)
DoEvents
Loop
End Sub
Private Sub Form_Load()
Shell "c:\windows\notepad.exe", vbNormalFocus 'Moves your form down and right to move out of the way
'of notepad
Me.Top = Screen.Height - Me.Height
Me.Left = Screen.Width - Me.Width
End Sub
No comments have been posted about Control other programs from your program. You can activate other program buttons and menus by using. Why not be the first to post a comment about Control other programs from your program. You can activate other program buttons and menus by using.