发信人: dega.p()
整理人: kamkam(2002-05-01 23:52:56), 站内信件
|
使用程序代替Notes不支持的SendKeys
SendKeys 函数虽然被写入了LotusScript,但是Notes并不支持它。包括所有的No tes版本,都不支持SendKeys.
请看如下程序,它能够完成SendKeys的功能。(尽管不能支持所有的键。)
原文请见:
http://www.itkey.com/itkey/home.nsf/4e67379e39a36b75c225672a0062568c/6 fab7649d8350aa2c225672b0028de08?OpenDocument
================================
Option Public
'
' Virtual Keys, Standard Set
'
Const VK_LBUTTON = &h01
Const VK_RBUTTON = &h02
Const VK_CANCEL = &h03
Const VK_MBUTTON = &h04 '/* NOT contiguous with L & RBUTTON */
Const VK_BACK = &h08
Const VK_TAB = &h09
Const VK_CLEAR = &h0C
Const VK_RETURN = &h0D
Const VK_SHIFT = &h10
Const VK_CONTROL = &h11
Const VK_MENU = &h12
Const VK_PAUSE = &h13
Const VK_CAPITAL = &h14
Const VK_ESCAPE = &h1B
Const VK_SPACE = &h20
Const VK_PRIOR = &h21
Const VK_NEXT = &h22
Const VK_END = &h23
Const VK_HOME = &h24
Const VK_LEFT = &h25
Const VK_UP = &h26
Const VK_RIGHT = &h27
Const VK_DOWN = &h28
Const VK_SELECT = &h29
Const VK_PRINT = &h2A
Const VK_EXECUTE = &h2B
Const VK_SNAPSHOT = &h2C
Const VK_INSERT = &h2D
Const VK_DELETE = &h2E
Const VK_HELP = &h2F
'* VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
'* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
Const VK_LWIN = &h5B
Const VK_RWIN = &h5C
Const VK_APPS = &h5D
Const VK_NUMPAD0 = &h60
Const VK_NUMPAD1 = &h61
Const VK_NUMPAD2 = &h62
Const VK_NUMPAD3 = &h63
Const VK_NUMPAD4 = &h64
Const VK_NUMPAD5 = &h65
Const VK_NUMPAD6 = &h66
Const VK_NUMPAD7 = &h67
Const VK_NUMPAD8 = &h68
Const VK_NUMPAD9 = &h69
Const VK_MULTIPLY = &h6A
Const VK_ADD = &h6B
Const VK_SEPARATOR = &h6C
Const VK_SUBTRACT = &h6D
Const VK_DECIMAL = &h6E
Const VK_DIVIDE = &h6F
Const VK_F1 = &h70
Const VK_F2 = &h71
Const VK_F3 = &h72
Const VK_F4 = &h73
Const VK_F5 = &h74
Const VK_F6 = &h75
Const VK_F7 = &h76
Const VK_F8 = &h77
Const VK_F9 = &h78
Const VK_F10 = &h79
Const VK_F11 = &h7A
Const VK_F12 = &h7B
Const VK_F13 = &h7C
Const VK_F14 = &h7D
Const VK_F15 = &h7E
Const VK_F16 = &h7F
Const VK_F17 = &h80
Const VK_F18 = &h81
Const VK_F19 = &h82
Const VK_F20 = &h83
Const VK_F21 = &h84
Const VK_F22 = &h85
Const VK_F23 = &h86
Const VK_F24 = &h87
Const VK_NUMLOCK = &h90
Const VK_SCROLL = &h91
'*
'* VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
'* Used only as parameters to GetAsyncKeyState() and GetKeyState().
'* No other API or message will distinguish left and right keys in thi s way.
'*
Const VK_LSHIFT = &hA0
Const VK_RSHIFT = &hA1
Const VK_LCONTROL = &hA2
Const VK_RCONTROL = &hA3
Const VK_LMENU = &hA4
Const VK_RMENU = &hA5
Const VK_PROCESSKEY = &hE5
Const VK_ATTN = &hF6
Const VK_CRSEL = &hF7
Const VK_EXSEL = &hF8
Const VK_EREOF = &hF9
Const VK_PLAY = &hFA
Const VK_ZOOM = &hFB
Const VK_NONAME = &hFC
Const VK_PA1 = &hFD
Const VK_OEM_CLEAR = &hFE
Declare Sub keybd_event Lib "user32.dll" (Byval bVk As Integer, Byval bScan As Integer, Byval dwFlags As Integer,Byval dwExtraInfo As Intege r)
Sub PressKeys(s As String)
Dim i As Integer
Dim c As String
special_hold=False
key=""
lastkey=""
For i=1 To Len(s)
c=Ucase(Mid$(s,i,1))
special_key=True
If c="+" Then
key=VK_SHIFT
lastkey=key
Elseif c="%" Then
key=VK_MENU
lastkey=key
Elseif c="^" Then
key=VK_LCONTROL
lastkey=key
Elseif c="(" Then
special_hold=True
Elseif c=")" Then
special_hold=False
Else
key=Asc(c)
special_key=False
End If
If key<>"" Then keybd_event key,0,0,0
If special_key Then
special_key=False
Else
If key<>"" Then
keybd_event key,0,2,0
key=""
End If
If lastkey<>"" Then
If Not special_hold Then
keybd_event lastkey,0,2,0
lastkey=""
End If
End If
End If
Next
End Sub
=====================
敬请关注NotesFAQ站
-- :◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
: ◇◇◇◇◇◇◇◇◇◇◇◇◇
: 总是想灌水*#$@&%!~
: ◇◇◇◇◇◇◇◇◇◇◇◇◇
:◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.167.50]
|
|