Skip to main content

AccessTr.neT


Fare tekerleği - MouseWhell On/Off

Fare tekerleği - MouseWhell On/Off

Thumbs Up #1
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

.rar MouseHook.rar (Dosya Boyutu: 14,87 KB | İndirme Sayısı: 110)
okileturc, 18-03-2009 tarihinden beri AccessTr.neT üyesidir.
Son Düzenleme: 21/03/2009, 15:24, Düzenleyen: okileturc.
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Fare tekerleği - MouseWhell On/Off - Yazar: okileturc - 21/03/2009, 15:21
Task