G
Guest
When creating a global mouse hook (WH_MOUSE_LL using SetWindowsHookEx) from a
..NET 2.0 or 1.1 application that has a form with XP Visual Styles enabled, if
the user clicks on the minimize, maximize or close button in the form's title
bar, the form freezes for 4-5 seconds. This does not happen in Win2K or when
visual
styles are disabled.
To see this problem in action, check out the project
http://www.codeproject.com/csharp/globalhook.asp
I've found that if you launch the hook in a separate thread, the window does
not freeze, however the mouse hook callback does not work. I suspect that my
SetWindowsHookEx arguments are incorrect for finding the callback function in
the separate thread:
m_MouseHook = SetWindowsHookEx( WH_MOUSE_LL, m_MouseHookProc,
Marshal.GetHINSTANCE( Assembly.GetExecutingAssembly().GetModules()[0] ), 0 );
I would prefer to launch the hook in the same thread to avoid
synchronization issues. So here are my questions:
1. Is there a way around the global mouse hook / Visual Styles freeze
problem?
2. If not, how do you launch a global mouse hook in a new thread?
Thank you!
Timm
..NET 2.0 or 1.1 application that has a form with XP Visual Styles enabled, if
the user clicks on the minimize, maximize or close button in the form's title
bar, the form freezes for 4-5 seconds. This does not happen in Win2K or when
visual
styles are disabled.
To see this problem in action, check out the project
http://www.codeproject.com/csharp/globalhook.asp
I've found that if you launch the hook in a separate thread, the window does
not freeze, however the mouse hook callback does not work. I suspect that my
SetWindowsHookEx arguments are incorrect for finding the callback function in
the separate thread:
m_MouseHook = SetWindowsHookEx( WH_MOUSE_LL, m_MouseHookProc,
Marshal.GetHINSTANCE( Assembly.GetExecutingAssembly().GetModules()[0] ), 0 );
I would prefer to launch the hook in the same thread to avoid
synchronization issues. So here are my questions:
1. Is there a way around the global mouse hook / Visual Styles freeze
problem?
2. If not, how do you launch a global mouse hook in a new thread?
Thank you!
Timm