Saturday, November 5, 2011

Capturing the Mouse of .Graphics Under Windows in C programming language

If in the process of drawing the freehand the mouse cursor goes outside the client area then the window below our window would start getting mouse messages. So our window would not receive any messages. If this has to be avoided then we should ensure that our window continues to receive mouse messages even when the cursor goes out of the client area of our window. The process of doing this is known as mouse capturing.
We have captured the mouse in OnLButtonDown( ) handler by calling the API function SetCapture( ). As a result, the program continues to respond to mouse events during freehand drawing even if the mouse is moved outside the client area. In the OnLButtonUp( ) handler we have released the captured mouse by calling the ReleaseCapture( ) API function

No comments:

Post a Comment