Solved

How can I catch a MoseMove over annother app. Window ?

Posted on 2002-03-05
1
200 Views
Last Modified: 2013-11-20
Hi

I want to catch the MouseMessages from annother applications window. SetCapture doesn´t catch the move messages. How can I do that ?
0
Comment
Question by:AndersCarlsson
1 Comment
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 200 total points
ID: 6843693
Hi AndersCarlsson,
       You have to set windows hook for mouse.

Create a dll, and write this code into it,
LoadTheDll from your application.

The code for setting up the hooks will look like this:

hhookMouse = SetWindowsHookEx(WH_MOUSE,
   (HOOKPROC) MouseFunc,  hInstance, 0);

…which will cause the following hook function to be called:

LRESULT CALLBACK MouseFunc(int nCode, WPARAM wParam, LPARAM lParam)
{
if ( nCode >= 0 )
         return 1;
else
   return(CallNextHookEx(hhookMouse, nCode, wParam, lParam));
}

Don't forget to unhook your hook before you exit by calling the following:

UnhookWindowsHookEx(hhookMouse);

GOOD LUCK
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Installing Microsoft R server on REDHAT or SUSE Linux 4 131
difference between String.subString() and String.subSequence() 6 177
Detect file exist or not 3 133
Change to event 1 103
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

867 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

20 Experts available now in Live!

Get 1:1 Help Now