[blue]Option Explicit
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 CallWindowProc Lib "user32" 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 Declare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const GWL_WNDPROC = (-4)
Public lpPrevWndProc As Long
Private Const WM_NCHITTEST = &H84
Private Const HTCLOSE = 20
Function WindowProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = WM_NCHITTEST Then
If DefWindowProc(hwnd, Msg, wParam, lParam) = HTCLOSE Then
If Screen.MousePointer <> vbHourglass Then
Screen.MousePointer = vbHourglass
End If
Else
If Screen.MousePointer <> vbDefault Then
Screen.MousePointer = vbDefault
End If
End If
End If
WindowProc = CallWindowProc(lpPrevWndProc, hwnd, Msg, wParam, lParam)
End Function[/blue]