user3477233
user3477233

Reputation: 37

How to draw the mouse cursor on the taken screenshot?

I'm trying to make a program for fun, which takes a screenshot. But I couldn't find how to draw the mouse cursor on the taken screenshot.

How to deal with this, please?

~IDE: Visual Studio 2013. ~OS: Windows 7 SP1.

Thanks a lot!

Upvotes: 3

Views: 349

Answers (1)

Ryand
Ryand

Reputation: 436

First you need to obtain the cursor information using GetCursorInfo():

CURSORINFO cinfo;
ZeroMemory(&cinfo, sizeof(CURSORINFO));
cinfo.cbSize = sizeof(CURSORINFO);
GetCursorInfo(&cinfo);

Then you can draw it into your screenshot bitmap using DrawIconEx():

DrawIconEx(hdcMemory, cinfo.ptScreenPos.x, cinfo.ptScreenPos.y, cinfo.hCursor, 0, 0, 0, NULL, DI_NORMAL);

Upvotes: 3

Related Questions