Free Web Site - Free Web Space and Site Hosting - Web Hosting - Internet Store and Ecommerce Solution Provider - High Speed Internet
Search the Web

Capture Mouse and Limit Mouse Position

VC++ (MFC) Tips :     Mouse and Cursor


Capture Mouse

   Key Functions:    SetCapture(); // Causes all subsequent mouse input to be sent to the current CWnd object regardless of the position of the cursor

SetCapture();
… //other codes
ReleaseCapture();    //release mouse cursor

 

Limit Mouse Position

   Key Functions:    ClipCursor(&rect);

RECT rect;
GetClientRect(&rect);    // Copies the client coordinates of the CWnd client area into the structure pointed to by lpRect.
ClientToScreen(&rect);    // Converts the client coordinates of a given point or rectangle on the display to screen coordinates.
ClipCursor(&rect);    // The cursor is a shared resource. If this parameter is NULL, the cursor is free to move anywhere on the screen.
… //other codes
ClipCursor(NULL);    //release mouse cursor


Copyright (c) 1999 - 2001, robert han, all rigths are reserved.