- 帖子
- 187
- 主題
- 52
- 精華
- 0
- 積分
- 230
- 點名
- 0
- 作業系統
- WIN 7
- 軟體版本
- 旗舰版
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2010-9-14
- 最後登錄
- 2026-9-27
|
以下指令是什麼意思
請教大大,以下VBA,每行指令是什麼意思,謝謝!
'**Win32 API Declarations
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal IpClassName As String, ByVal IpWindowName As String) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, IpRect As RECT) As Long
'**Win32 API User Defined Types
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub test()
Dim Rec As RECT
'Get Left, Right, Top and Bottom of Form1
GetWindowRect GetWindowHandle, Rec
'Set Cursor position on X
SetCursorPos Rec.Right - 600, Rec.Top + 400
End Sub
Private Function GetWindowHandle() As Long
Const CLASSNAME_M**cel="XLMAIN"
'Gets the Apps window handle, since you can't use App.hInstance in VBA (VB Only)
GetWindowHandle = FindWindow(CLASSNAME_M**cel, vbNullString)
End Function |
|