Public Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const GWL_WNDPROC = (-4)
Public Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Public hOldWndProc As Long
Public Declare Function GetAsyncKeyState Lib "user32.dll" _
(ByVal vKey As Long) As Integer
Public Const HTCAPTION = 2
Public Function WndProc(ByVal hWnd As Long, ByVal msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
If msg = WM_NCHITTEST Then
If GetAsyncKeyState(vbKeyLButton) < 0 Then
Form1.Label3.Caption = "移動中"
WndProc = HTCAPTION
Exit Function
Else
Form1.Label3.Caption = ""
End If
End If
WndProc = CallWindowProc(hOldWndProc, hWnd, msg, wParam, lParam)
End Function |