Section 4. example – MagTek SENDKEYS.OCX User Manual

Page 13

Advertising
background image

9

SECTION 4. EXAMPLE


Private Sub Command1_Click()
Dim Response As Integer

'Set the Target Application to Untitled - Notepad
SendKeys1.TargetApp = "Untitled - Notepad"

'Do not wait for this application to become active first
SendKeys1.WaitForApp = False

'Do not wait for the keystrokes to be processed
SendKeys1.WaitForKeys = False

'Send the Keystrokes - Hello World! and the Enter key
Response = SendKeys1.SendData("Hello World!{ENTER}")

Select Case Response
Case 0
txtStatus.Text = "Success"
Case 5
txtStatus.Text = "Application: " & SendKeys1.TargetApp & " is not running"
Case Else
txtStatus.Text = "Unknown Error"
End Select

End Sub

Advertising