S
stefan hoffmann
hi,
i am subclassing Application.hWndAccessApp to catch user messages
(WM_USER). It works, but it makes Access _very_ instable.
Is there a better way to catch messages sent to Access?
mfG
--> stefan <--
Public Function WndProc(ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long _
) As Long
Select Case Msg
Case WM_USER:
MsgBox "WM_USER: " & Hex(lParam)
Case Else
WndProc = apiCallWindowProc(lpPrevWndProc, hWnd, Msg, _
wParam, lParam)
End Select
End Function
Public Sub Hook()
lpPrevWndProc = apiSetWindowLong(Application.hWndAccessApp, _
GWL_WNDPROC, AddressOf SubclassAccess.WndProc)
End Sub
Public Sub Unhook()
apiSetWindowLong Application.hWndAccessApp, GWL_WNDPROC, lpPrevWndProc
End Sub
i am subclassing Application.hWndAccessApp to catch user messages
(WM_USER). It works, but it makes Access _very_ instable.
Is there a better way to catch messages sent to Access?
mfG
--> stefan <--
Public Function WndProc(ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long _
) As Long
Select Case Msg
Case WM_USER:
MsgBox "WM_USER: " & Hex(lParam)
Case Else
WndProc = apiCallWindowProc(lpPrevWndProc, hWnd, Msg, _
wParam, lParam)
End Select
End Function
Public Sub Hook()
lpPrevWndProc = apiSetWindowLong(Application.hWndAccessApp, _
GWL_WNDPROC, AddressOf SubclassAccess.WndProc)
End Sub
Public Sub Unhook()
apiSetWindowLong Application.hWndAccessApp, GWL_WNDPROC, lpPrevWndProc
End Sub