vbAccelerator - Contents of code file: frmSendKeys.frm
VERSION 5.00
Begin VB.Form frmSendKeys
Caption = "API SendKeys Demonstration"
ClientHeight = 4065
ClientLeft = 2895
ClientTop = 2715
ClientWidth = 4260
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmSendKeys.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4065
ScaleWidth = 4260
Begin VB.TextBox txtTest2
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 960
TabIndex = 2
Text = "This text will be replaced"
Top = 600
Width = 2415
End
Begin VB.CommandButton cmdCloseMe
Caption = "Close &Me"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 1020
TabIndex = 4
Top = 1860
Width = 1215
End
Begin VB.CommandButton cmdSendKeys
Caption = "&Send Keys"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 1020
TabIndex = 3
Top = 1260
Width = 1215
End
Begin VB.TextBox txtTest
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 960
TabIndex = 1
Top = 180
Width = 2415
End
Begin VB.Label lblTest
Caption = "&Test"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 0
Top = 240
Width = 795
End
End
Attribute VB_Name = "frmSendKeys"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdCloseMe_Click()
Dim cSK As New cSendKeys
cSK.SendKeys "%({F4})"
End Sub
Private Sub cmdSendKeys_Click()
Dim cSK As New cSendKeys
' using the VB send keys method:
cSK.SendKeys "%(T)Steve"
' using keyup/keydown.
' tab to the second text box:
cSK.KeyDown vbKeyTab
cSK.KeyUp vbKeyTab
' Open the menu:
cSK.KeyDown MoreKeyConstants.VK_APPS
cSK.KeyUp MoreKeyConstants.VK_APPS
' Select the sixth item ("Select All")
Dim i As Long
For i = 1 To 6
cSK.KeyDown vbKeyDown
cSK.KeyUp vbKeyDown
Next i
' Choose it:
cSK.KeyDown vbKeyReturn
cSK.KeyUp vbKeyReturn
' Add some text:
cSK.SendKeys "New Text"
End Sub
Private Sub txtTest2_KeyDown(KeyCode As Integer, Shift As Integer)
Debug.Print KeyCode
End Sub
|
|