Refinance | Credit Cards | Car Insurance | Fast Loans | Abercrombie deals
cursor postion [Archive] - PCMech Forums

PDA

View Full Version : cursor postion


kcbhiw
08-10-2000, 08:50 PM
Can anybody suggest a way of determining the x and y coordinates of the mouse cursor in a GUI app? I'm using Borland C++ builder 4. I simply want to determine the x and y coordinates and have been racking my brain trying to figure how to accomplish it. Thanks in advance.

UncaDanno
08-11-2000, 03:54 AM
Are you talking about the mouse position when it moves or when it is clicked?

Really, either way, you can trap the mouse position (when it is over the window of your app) by putting code in your Windows message handling loop to trap the mouse move and mouse click events. These windows messages carry the mouse coordinates with them.

I recall there's a pretty decent reference of the windows messages in the online docs. You can also look in the tutorials if you have some C++ learning guides lying around.

You can (sometimes) capture windows messages when the focus in on other apps. It's a bit more difficult, but it can be done.

Sorry about the high-levelness of this. It's been a while since I had my fingers in C++ code.