|
楼主 |
发表于 2010-12-19 22:01
|
显示全部楼层
- Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
- Private Declare Function ReleaseCapture Lib "user32" () As Long
- Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
- Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
- Dim hwnd As Long
- Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
- Dim bo As Boolean
- bo = (0 <= X) And (X <= UserForm1.Width-5) And (0 <= Y) And (Y <= UserForm1.Height-27)
- If bo Then
- Me.Caption = "进去"
- hwnd = FindWindow(vbNullString, Me.Caption)
- hwnd = FindWindowEx(hwnd, 0, vbNullString, vbNullString) '嗨,以前就差这一句
- SetCapture hwnd
- Else
- Me.Caption = "出来"
- ReleaseCapture
- End If
- End Sub
复制代码
[ 本帖最后由 HHAAMM 于 2010-12-20 13:47 编辑 ] |
|