View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Bill Renaud[_2_] Bill Renaud[_2_] is offline
external usenet poster
 
Posts: 117
Default Subclassing in Excel ! ...So frustrating !

Dim OldWindowProc As Long
Dim hwnd As Long
Dim lngCurPos As POINTAPI
Dim R As Range

Sub SubClass()

'Subclass The ONLY loaded workbook Window
hwnd = Application.hwnd
hwnd = FindWindowEx(hwnd, 0, "XLDESK", vbNullString)
hwnd = FindWindowEx(hwnd, 0, "EXCEL7", vbNullString)

OldWindowProc = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf

NewWindowProc)

End Sub


After the Sub named SubClass is run, doesn't the variable OldWindowProc (as
well as all of the other module-level variables) go out of scope? This would
mean that VBA would throw the value away (clear it?), meaning it will no
longer be available for later calls when the mouse moves over the window and
needs to use it again.
--
Regards,
Bill