VicoLaChips2
Messages postés436Date d'inscriptiondimanche 20 janvier 2002StatutMembreDernière intervention 2 février 20102 21 sept. 2002 à 18:16
Bonjour ,
'==============inside a MODULE
Option Explicit
'************************************************************
'API
'************************************************************
Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" ( _
ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
'zDelta: The value of the high-order word of wParam.
'Indicates the distance that the wheel is rotated, expressed in multiples or
'divisions of WHEEL_DELTA, which is 120. A positive value indicates that the
'wheel was rotated forward, away from the user; a negative value indicates
'that the wheel was rotated backward, toward the user.
Private Function WindowProc(ByVal lWnd As Long, ByVal lMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Dim fwKeys As Long
Dim zDelta As Long
Dim xPos As Long
Dim yPos As Long
'Test if the message is WM_MOUSEWHEEL
If lMsg = WM_MOUSEWHEEL Then
fwKeys = wParam And 65535
zDelta = wParam / 65536
xPos = lParam And 65535
yPos = lParam / 65536
'Call the Form's Procedure to handle the MouseWheel event
frmAgenda.MouseWheel fwKeys, zDelta, xPos, yPos
End If
'Sends message to previous procedure
'This is VERY IMPORTANT!!!
WindowProc = CallWindowProc(lPrevWndProc, lWnd, lMsg, wParam, lParam)
End Function
'*************************************************************
'Hook
'*************************************************************
Public Sub Hook(ByVal hControl_ As Long)
hControl = hControl_
lPrevWndProc = SetWindowLong(hControl, GWL_WNDPROC, AddressOf WindowProc)
End Sub
'*************************************************************
'UnHook
'*************************************************************
Public Sub UnHook()
Call SetWindowLong(hControl, GWL_WNDPROC, lPrevWndProc)
End Sub
VicoLaChips2
Messages postés436Date d'inscriptiondimanche 20 janvier 2002StatutMembreDernière intervention 2 février 20102 21 sept. 2002 à 18:16
Bonjour ,
'==============inside a MODULE
Option Explicit
'************************************************************
'API
'************************************************************
Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" ( _
ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
'zDelta: The value of the high-order word of wParam.
'Indicates the distance that the wheel is rotated, expressed in multiples or
'divisions of WHEEL_DELTA, which is 120. A positive value indicates that the
'wheel was rotated forward, away from the user; a negative value indicates
'that the wheel was rotated backward, toward the user.
Private Function WindowProc(ByVal lWnd As Long, ByVal lMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Dim fwKeys As Long
Dim zDelta As Long
Dim xPos As Long
Dim yPos As Long
'Test if the message is WM_MOUSEWHEEL
If lMsg = WM_MOUSEWHEEL Then
fwKeys = wParam And 65535
zDelta = wParam / 65536
xPos = lParam And 65535
yPos = lParam / 65536
'Call the Form's Procedure to handle the MouseWheel event
frmAgenda.MouseWheel fwKeys, zDelta, xPos, yPos
End If
'Sends message to previous procedure
'This is VERY IMPORTANT!!!
WindowProc = CallWindowProc(lPrevWndProc, lWnd, lMsg, wParam, lParam)
End Function
'*************************************************************
'Hook
'*************************************************************
Public Sub Hook(ByVal hControl_ As Long)
hControl = hControl_
lPrevWndProc = SetWindowLong(hControl, GWL_WNDPROC, AddressOf WindowProc)
End Sub
'*************************************************************
'UnHook
'*************************************************************
Public Sub UnHook()
Call SetWindowLong(hControl, GWL_WNDPROC, lPrevWndProc)
End Sub
VicoLaChips2
Messages postés436Date d'inscriptiondimanche 20 janvier 2002StatutMembreDernière intervention 2 février 20102 21 sept. 2002 à 18:16
Bonjour ,
'==============inside a MODULE
Option Explicit
'************************************************************
'API
'************************************************************
Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" ( _
ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
'zDelta: The value of the high-order word of wParam.
'Indicates the distance that the wheel is rotated, expressed in multiples or
'divisions of WHEEL_DELTA, which is 120. A positive value indicates that the
'wheel was rotated forward, away from the user; a negative value indicates
'that the wheel was rotated backward, toward the user.
Private Function WindowProc(ByVal lWnd As Long, ByVal lMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Dim fwKeys As Long
Dim zDelta As Long
Dim xPos As Long
Dim yPos As Long
'Test if the message is WM_MOUSEWHEEL
If lMsg = WM_MOUSEWHEEL Then
fwKeys = wParam And 65535
zDelta = wParam / 65536
xPos = lParam And 65535
yPos = lParam / 65536
'Call the Form's Procedure to handle the MouseWheel event
frmAgenda.MouseWheel fwKeys, zDelta, xPos, yPos
End If
'Sends message to previous procedure
'This is VERY IMPORTANT!!!
WindowProc = CallWindowProc(lPrevWndProc, lWnd, lMsg, wParam, lParam)
End Function
'*************************************************************
'Hook
'*************************************************************
Public Sub Hook(ByVal hControl_ As Long)
hControl = hControl_
lPrevWndProc = SetWindowLong(hControl, GWL_WNDPROC, AddressOf WindowProc)
End Sub
'*************************************************************
'UnHook
'*************************************************************
Public Sub UnHook()
Call SetWindowLong(hControl, GWL_WNDPROC, lPrevWndProc)
End Sub
VicoLaChips2
Messages postés436Date d'inscriptiondimanche 20 janvier 2002StatutMembreDernière intervention 2 février 20102 21 sept. 2002 à 18:17
Bonjour ,
'==============inside a MODULE
Option Explicit
'************************************************************
'API
'************************************************************
Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" ( _
ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
'zDelta: The value of the high-order word of wParam.
'Indicates the distance that the wheel is rotated, expressed in multiples or
'divisions of WHEEL_DELTA, which is 120. A positive value indicates that the
'wheel was rotated forward, away from the user; a negative value indicates
'that the wheel was rotated backward, toward the user.
Private Function WindowProc(ByVal lWnd As Long, ByVal lMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Dim fwKeys As Long
Dim zDelta As Long
Dim xPos As Long
Dim yPos As Long
'Test if the message is WM_MOUSEWHEEL
If lMsg = WM_MOUSEWHEEL Then
fwKeys = wParam And 65535
zDelta = wParam / 65536
xPos = lParam And 65535
yPos = lParam / 65536
'Call the Form's Procedure to handle the MouseWheel event
frmAgenda.MouseWheel fwKeys, zDelta, xPos, yPos
End If
'Sends message to previous procedure
'This is VERY IMPORTANT!!!
WindowProc = CallWindowProc(lPrevWndProc, lWnd, lMsg, wParam, lParam)
End Function
'*************************************************************
'Hook
'*************************************************************
Public Sub Hook(ByVal hControl_ As Long)
hControl = hControl_
lPrevWndProc = SetWindowLong(hControl, GWL_WNDPROC, AddressOf WindowProc)
End Sub
'*************************************************************
'UnHook
'*************************************************************
Public Sub UnHook()
Call SetWindowLong(hControl, GWL_WNDPROC, lPrevWndProc)
End Sub
Hook --> Mon Control et at the end UnHook
Vous n’avez pas trouvé la réponse que vous recherchez ?
portzic
Messages postés6Date d'inscriptionvendredi 20 septembre 2002StatutMembreDernière intervention26 septembre 2002 26 sept. 2002 à 07:15
Re: bonjour
au risque d'etre ridicule:
J'ai donc copier le code dans un module mais je ne vois pas comment l'associer à mes differents dbcombo et dbgrid de mon apllication.
rq:quand je compile l'exe, frmagenda(Private Function WindowProc), vb6 me renvoi l'erreur: variable non declarée