Solved

Win32 hooks (WH_MOUSE)

Posted on 1998-11-06
3
1,321 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
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 80 total points
Comment Utility
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
Comment Utility
Thank you very much jkr!
Everything works good!
0
 

Expert Comment

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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

771 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now