So, as a follow up on my previous thread:
http://www.mrexcel.com/forum/showthread.php?p=2690602#post2690602
Which miserably failed. I have been testing and writing code all day to find out why things are not working.
I now know that the problem lies within the "hooking" of the userform. But I don't know why it keeps terminating when coming there. these are the two parts that do the hooking:
The first one is called by mouseover events from the listboxes and from the Userform itself. Although when the mouseover event for the Userform gets raised, it isnt the hookup but the unhook path that is run. These are the subs for the unhooking:
The code fails the moment that the cursor comes onto the Userform, and the Mousemove event is raised. But since "blnHooked" is "false" from the beginning, nothing should happen.
Any idea on why the MouseMove event causes a crash??
Any help will be greatly appreciated!
http://www.mrexcel.com/forum/showthread.php?p=2690602#post2690602
Which miserably failed. I have been testing and writing code all day to find out why things are not working.
I now know that the problem lies within the "hooking" of the userform. But I don't know why it keeps terminating when coming there. these are the two parts that do the hooking:
Code:
Private Sub List_Hook()
'Maakt de Hook alleen als deze nog niet bestaat
If Not blnHooked Then
WheelHook FlensDefinitie
blnHooked = True
End If
End Sub
Code:
Public Sub WheelHook(ClientForm As UserForm)
hWnd_UserForm = FindWindow("ThunderDFrame", ClientForm.Caption)
lngWndProc = SetWindowLong(hWnd_UserForm, GWL_WNDPROC, AddressOf WindowProc)
End Sub
The first one is called by mouseover events from the listboxes and from the Userform itself. Although when the mouseover event for the Userform gets raised, it isnt the hookup but the unhook path that is run. These are the subs for the unhooking:
Code:
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
LH = 0
'Vernietigd de hook als de muis niet op de control is.
Call List_UnHook
End Sub
Code:
Private Sub List_UnHook()
'Vernietigd de hook alleen als deze al bestaat
If blnHooked Then
WheelUnHook
blnHooked = False
End If
End Sub
Code:
Public Sub WheelUnHook()
Dim lRet As Long
lRet = SetWindowLong(hWnd_UserForm, GWL_WNDPROC, lngWndProc)
End Sub
The code fails the moment that the cursor comes onto the Userform, and the Mousemove event is raised. But since "blnHooked" is "false" from the beginning, nothing should happen.
Any idea on why the MouseMove event causes a crash??
Any help will be greatly appreciated!