Public Declare Function WindowFromPoint Lib "user32" (ByVal X As Long, ByVal y As Long) As Long
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Type POINTAPI
X As Long
y As Long
End Type
Public Type DGfor3
ponX As Long
ponY As Long
MDC As Long
End Type
Public Function MouseDC() As DGfor3
On Error Resume Next
Dim Cur As POINTAPI
GetCursorPos Cur
MouseDC.MDC = WindowFromPoint(Cur.X, Cur.y)
MouseDC.ponX = Cur.X
MouseDC.ponY = Cur.y
End Function
---------------------------------------------------------------------------------
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
Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As Long, ByVal id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long
Declare Function UnregisterHotKey Lib "user32" (ByVal hwnd As Long, ByVal id As Long) As Long
Public Const WM_HOTKEY = &H312
Public Const MOD_CONTROL = &H2
Public Const GWL_WNDPROC = (-4)
Public hWndLong() As Long
Public Function WndProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = WM_MOUSEWHEEL Then
'
End If
End Function
-------------------------------------------------------------------------------
Form Code:
Private Sub Form_Load()
Dim ret As Long
Timer1.Interval = 20
hWndLong = GetWindowLong(Mousedc.mdc.hwnd, GWL_WNDPROC)
ret = SetWindowLong(Mousedc.mdc.hwnd, GWL_WNDPROC, AddressOf WndProc)
end sub
Private Sub Timer1_Timer()
Dim ret As Long
ret = SetWindowLong(Mousedc.mdc.hwnd, GWL_WNDPROC, hWndLong)
hWndLong = GetWindowLong(Mousedc.mdc.hwnd, GWL_WNDPROC)
ret = SetWindowLong(Mousedc.mdc.hwnd, GWL_WNDPROC, AddressOf WndProc)
end sub