Hello,

I am trying to create a button using the Windows API (not using Windows Forms), using OpenGL in 2D mode to draw the button. So far, what I have done is to monitor every time the mouse is clicked, using the WndProc() function, and to check whether the mouse cursor lies within the boundary of the box. Then, I call the button's relevant function to indicate a button click.

This works fine, but I now want to extend this to change the image drawn by the button when it is clicked. Just like with Windows buttons, I want to change the image so that it looks like the button is pressed into the screen. Then, when the mouse button is released, or the cursor moves outside the button's bounding box, the image should change back to the unpressed image.

To change the button to the pressed image is easy - just by checking the mouse click location in WndProc() - but how can I tell when the button is released? The only way I can think of doing this is by continually monitoring the cursor's location in WndProc(), and when it moves outside of the button's bounding box, then change the image back. But this seems like a lot of unneccessary checking of the mouse's location. Is there a neater way of doing it?

Thanks!!