How to set the area / rectangle in which the cursor is allowed to move?

eg. when you get to the side of the monitor, your cursor cannot go any further, and, moreover, the example is when in the microsoft paint, and you select a color from the RGB table, this will not allow your mouse to go beyond the rectangle until your mouse works.

My question is how to implement this in C ++ using win32 api?

+3
source share
3 answers

You can use the following function from Microsoft

BOOL WINAPI ClipCursor(
  __in_opt  const RECT *lpRect
); 

See http://msdn.microsoft.com/en-us/library/ms648383(VS.85).aspx

+3
source

ClipCursor. , . ( , ), NULL .

+2

If you want to do this in a cross-platform way, you can try this library .

0
source

Source: https://habr.com/ru/post/1763644/


All Articles