Ray Stantz
Registered User.
- Local time
- Today, 09:06
- Joined
- Nov 16, 2006
- Messages
- 63
Happy Friday!
One lingering issue i hope an expert can help me out with. I did a search but didn't find this exact problem/solution. I have a database setup with a procedure on the Load event and module that locks my mouse wheel so it does not scroll to another record. It works fine for me and any user that has Read/Write/Insert/Delete permissions. The issue is the mouse wheel is not locking for any user that has Read/Insert permissions only and no Delete/Update permissions.
This is what i have in the Load Event:
Unload
Module
Anyone know why this is occurring?
One lingering issue i hope an expert can help me out with. I did a search but didn't find this exact problem/solution. I have a database setup with a procedure on the Load event and module that locks my mouse wheel so it does not scroll to another record. It works fine for me and any user that has Read/Write/Insert/Delete permissions. The issue is the mouse wheel is not locking for any user that has Read/Insert permissions only and no Delete/Update permissions.
This is what i have in the Load Event:
Code:
'Store handle to this form's window
gHW = Me.hwnd
If IsHooked Then
Call Unhook
End If
'Call procedure to begin capturing messages for this window
Call Hook
'END OF SUBROUTINE
Unload
Code:
Call Unhook
Module
Code:
Option Compare Database
Option Explicit
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 SetWindowLong Lib "User32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function RegisterWindowMessage& Lib "User32" Alias "RegisterWindowMessageA" _
(ByVal lpString As String)
Public Const GWL_WNDPROC = -4
Public IsHooked As Boolean
Public lpPrevWndProc As Long
Public gHW As Long
Public Sub Hook()
If IsHooked Then
'MsgBox "Don't hook it twice without " & _
' "unhooking, or you will be unable to unhook it."
IsHooked = True
Else
lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, _
AddressOf WindowProc)
IsHooked = True
End If
End Sub
Public Sub Unhook()
Dim temp As Long
temp = SetWindowLong(gHW, GWL_WNDPROC, lpPrevWndProc)
IsHooked = False
End Sub
Function WindowProc(ByVal hw As Long, ByVal uMsg As _
Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If uMsg = GetMouseWheelMsg Then
' Debug.Print "Message: "; hw, uMsg, wParam, lParam
WindowProc = 0
Else
WindowProc = CallWindowProc(lpPrevWndProc, hw, _
uMsg, wParam, lParam)
End If
End Function
Public Function GetMouseWheelMsg() As Long
GetMouseWheelMsg = 522 'this works for Win98/2000, otherwise use
'RegisterWindowMessage("MSWHEEL_ROLLMSG")
End Function
Anyone know why this is occurring?