Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw mouse pointer icon?

I am coding little fun gadget. I want to be able to draw second (or more) mouse pointer icons at different location than the original mouse but to move it according to move of original mouse.

I know how to track movement of the mouse but I dunno how to draw/redraw mouse pointer; can anyone help?

like image 343
VisaToHell Avatar asked May 30 '12 19:05

VisaToHell


People also ask

What is mouse pointer draw any two mouse pointer?

A mouse cursor, also known as a mouse arrow, or mouse pointer, is a graphical image used to activate or control certain elements in a graphical user interface. More plainly, it indicates where your mouse should perform its next action, such as opening a program or dragging a file to another location.


1 Answers

You can use the following code:

CURSORINFO ci;
ci.cbSize = sizeof(CURSORINFO);
GetCursorInfo(&ci);

Next you can draw a cursor by calling:

DrawIcon(ContextDC, YourXPosition, YourYPosition, ci.hCursor);

If you need additional information about the cursor, like hotspot for example, check the ICONINFO structure:

ICONINFO ii;
GetIconInfo(ci.hCursor, &ii);
like image 151
Forgottn Avatar answered Sep 21 '22 08:09

Forgottn