M
mike
I'm using, in an excel2000 sheet, the following code to
get mouse control:
Private Declare Function SetWindowLong Lib "user32"
Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex
As Long, ByVal dwNewLong As Long) As Long
Private 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
Private Declare Function GetCursorPos Lib "user32" (point
As POINTAPI) As Long
Public Sub captureInput(App As Application)
If Not isEqual(GetWindowLong(App.hwnd, GWL_WNDPROC),
AddressOf WindowProc) Then
Set aW = App.ActiveWindow
PrevProc = SetWindowLong(App.hwnd, GWL_WNDPROC,
AddressOf WindowProc)
End If
End Sub
Public Function WindowProc(ByVal hwnd As Long, ByVal uMsg
As Long, ByVal wParam As Long, ByVal lParam As Long) As
Long
Select Case uMsg
Case WM_MOUSEMOVE
If Not is_Working Then
is_Working = True: GetCursorPos point
Call handleTypes(point)
is_Working = False
End If
End Select
'-----------------------------
WindowProc = CallWindowProc(PrevProc, hwnd, uMsg,
wParam, lParam)
End Function
.........
In an Workbook_Open event:
Call captureInput(App)
.........
Everything functions well until I put everything in an Add-
in. Then I get this error 28 - Stack overflow
Thanks in advance!
get mouse control:
Private Declare Function SetWindowLong Lib "user32"
Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex
As Long, ByVal dwNewLong As Long) As Long
Private 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
Private Declare Function GetCursorPos Lib "user32" (point
As POINTAPI) As Long
Public Sub captureInput(App As Application)
If Not isEqual(GetWindowLong(App.hwnd, GWL_WNDPROC),
AddressOf WindowProc) Then
Set aW = App.ActiveWindow
PrevProc = SetWindowLong(App.hwnd, GWL_WNDPROC,
AddressOf WindowProc)
End If
End Sub
Public Function WindowProc(ByVal hwnd As Long, ByVal uMsg
As Long, ByVal wParam As Long, ByVal lParam As Long) As
Long
Select Case uMsg
Case WM_MOUSEMOVE
If Not is_Working Then
is_Working = True: GetCursorPos point
Call handleTypes(point)
is_Working = False
End If
End Select
'-----------------------------
WindowProc = CallWindowProc(PrevProc, hwnd, uMsg,
wParam, lParam)
End Function
.........
In an Workbook_Open event:
Call captureInput(App)
.........
Everything functions well until I put everything in an Add-
in. Then I get this error 28 - Stack overflow
Thanks in advance!