Solved

Win32 hooks (WH_MOUSE)

Posted on 1998-11-06
3
1,380 Views
Last Modified: 2009-06-10
Hello all!

I have problem establishing Win32 hook for mouse events (WH_MOUSE). When mouse cursor is in main frame window boundaryes everithing is ok, my hook is called, but when
mouse cursor leaves window, my hook function is not called.
Who can explain me wats metter?
Thenk you beforehend. George.
0
Comment
Question by:george_777
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 80 total points
ID: 1177115
Yes. The problem is, that when you want to capure events that are not related to your application's window, the hook proc must reside in a DLL, as system-wide hooks are simply mapped into the other processes' addres spaces. Additionally, when calling 'SetWindowsHookEx()', you'll have to set the thread id to '0' and provide the DLL's instance handle (obtained via 'LoadLibrary()'). If you need an example, feel free to ask and i'll mail it to you.
0
 

Author Comment

by:george_777
ID: 1177116
Thank you very much jkr!
Everything works good!
0
 

Expert Comment

by:sergiob2004
ID: 12653785
No way, at least under Windows XP + SVP2 WH_MOUSE won't go global, you must use WH_MOUSE_LL instead.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question