Mouse Location after Click

I'm relatively new to handling mouse events and can't get it to work.

How would you get the mouse location only after pressing the left mouse button for instance? I can just get the location with:

POINT pt;
GetCursorPos(&pt);

But I don't know how to tell it to wait for a click first. Thanks for any help.
I think you should first get whether the mouse has clicked and after the position, for doing it with Win API take a look at this example: http://msdn.microsoft.com/en-us/library/ms685035(VS.85).aspx
Thanks for the advice, I just don't understand anything about API. I really don't understand what any of those values mean in the MSDN website and why things look like that.

I need to figure out how to code:

wait for a mouse click.
find location. // I can do that already.
The (x,y) position is part of the information that comes with the mouse event.

Are you doing this in a GUI or Console program?
I'm doing it in a GUI. (fltk)

I already have something like this:

POINT pt;

if(GetCursorPos(&pt)!=0)
{
x=pt.x;
y=pt.y;
}

This tells me the location but it does it instantly at the beginning. I need to wait for a mouse click first, but I don't know how to do that.
The FLTK documentation takes a little getting used to.

Every time you do something, it generates an event and sends it to the associated widget via the handle() virtual function. Here is a little example that displays how to override it and trap events.
http://www3.telus.net/public/robark/#events

Learn more about handling events from the FLTK documentation (scroll down to "handling events")
http://www.fltk.org/doc-2.0/html/index.html

The following may also be useful
http://www.fltk.org/doc-2.0/html/namespacefltk.html#1709b936ed1213afe73358be47e7a4df

Hope this helps.
Topic archived. No new replies allowed.