我查了下并没有啊.......公共模块里有 Declare Function adh_apiSendMessage Lib "USER32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long ' Create an Information Context
Declare Function adh_apiCreateIC Lib "gdi32" Alias "CreateICA" _
(ByVal lpDriverName As String, ByVal lpDeviceName As String, _
ByVal lpOutput As String, lpInitData As Any) As Long
' Close an existing Device Context (or information context)
Declare Function adh_apiDeleteDC Lib "gdi32" Alias "DeleteDC" _
(ByVal hdc As Long) As Long
================================ '拖动窗体的API
Public Declare Function ReleaseCapture Lib "USER32" () As Long
Public Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
'/* 常量声明部分 */
Public Const RGN_OR = 2
Public Const HTCAPTION = 2
Public Const WM_NCLBUTTONDOWN = &HA1 Public Declare Function DrawMenuBar Lib "USER32" (ByVal hWnd As Long) As Long
Public Declare Function GetWindowLong Lib "USER32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "USER32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Const GWL_STYLE As Long = (-16)
Public Const WS_CAPTION As Long = &HC00000
'/* 类型声明部分 */
Public Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmHightBytes As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
========================= '声明必要的 API 例程:
Declare Function FindWindow Lib "USER32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As Long) As Long Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Public MyXL As Object
===================== Sub DetectExcel()
'该过程检测并登记正在运行的 Excel。
Const WM_USER = 1024
Dim hWnd As Long
'如果 Excel 在运行,则该 API 调用将返回其句柄。
hWnd = FindWindow("XLMAIN", 0)
If hWnd = 0 Then '0 表示没有 Excel 在运行。
Exit Sub
Else
'Excel 在运行,因此可以使用 SendMessage API
'函数将其放入运行对象表。
SendMessage hWnd, WM_USER + 18, 0, 0
End If
End Sub
================= Private Sub 主体_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'单击主窗体可进行移动,代码来自模块
ReleaseCapture '释放鼠标
SendMessage hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0& End Sub
-===== 就这些定义共公模块啊编译到这时 Private Sub 主体_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'单击主窗体可进行移动,代码来自模块
ReleaseCapture '释放鼠标
SendMessage hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0& End Sub
提示二次定义啊..那里有问题吗 |