AccessTr.neT
Fare tekerleği - MouseWhell On/Off - Baskı Önizleme

+- AccessTr.neT (https://accesstr.net)
+-- Forum: Microsoft Access (https://accesstr.net/forum-microsoft-access.html)
+--- Forum: Access Örnekleri ve Uygulamaları (https://accesstr.net/forum-access-ornekleri-ve-uygulamalari.html)
+--- Konu Başlığı: Fare tekerleği - MouseWhell On/Off (/konu-fare-tekerlegi-mousewhell-on-off.html)



Fare tekerleği - MouseWhell On/Off - okileturc - 21/03/2009

Aşağıdaki kodu modül olarak kayıt edin
Ekteki DLL dosyasını uygulama klasörüne kopyalayın

Kod:
Option Compare Database

Option Explicit

Private Declare Function LoadLibrary Lib "kernel32" _
Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long

Private Declare Function FreeLibrary Lib "kernel32" _
(ByVal hLibModule As Long) As Long

Private Declare Function StopMouseWheel Lib "MouseHook" _
(ByVal hWnd As Long, ByVal AccessThreadID As Long, Optional ByVal blIsGlobal As Boolean = False) As Boolean

Private Declare Function StartMouseWheel Lib "MouseHook" _
(ByVal hWnd As Long) As Boolean

Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long

Private hLib As Long


Public Function MouseWheelON() As Boolean
MouseWheelON = StartMouseWheel(Application.hWndAccessApp)
If hLib <> 0 Then
    hLib = FreeLibrary(hLib)
End If
End Function

Public Function MouseWheelOFF(Optional GlobalHook As Boolean = False) As Boolean
Dim s As String
Dim blRet As Boolean
Dim AccessThreadID As Long

On Error Resume Next
s = "Sorry...cannot find the MouseHook.dll file" & vbCrLf
s = s & "Please copy the MouseHook.dll file to your Windows System folder or into the same folder as this Access MDB."
hLib = LoadLibrary("MouseHook.dll")
If hLib = 0 Then
    hLib = LoadLibrary(CurrentDBDir() & "MouseHook.dll")
    If hLib = 0 Then
        MsgBox s, vbOKOnly, "MISSING MOUSEHOOK.dll FILE"
        MouseWheelOFF = False
        Exit Function
    End If
End If
AccessThreadID = GetCurrentThreadId()
MouseWheelOFF = StopMouseWheel(Application.hWndAccessApp, AccessThreadID, GlobalHook)
End Function

Function CurrentDBDir() As String
Dim strDBPath As String
Dim strDBFile As String
    strDBPath = CurrentDb.NAME
    strDBFile = Dir(strDBPath)
    CurrentDBDir = Left$(strDBPath, Len(strDBPath) - Len(strDBFile))
End Function

Formda fare tekerleği iptal için örnek ...

Kod:
Private Sub Form_Load()
Dim blRet As Boolean
blRet = MouseWheelOFF(False)
End Sub




Cvp: Fare tekerleği - MouseWhell On/Off - tdsharun - 21/03/2009

Daha önce bir soruya cevaben adminimiz vermişti ancak yeni bir başlık altında olması iyi olmuş...

Teşekkürler...