Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw the mouse cursor on the taken screenshot?

Tags:

c++

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!

like image 216
user3477233 Avatar asked Jan 01 '26 02:01

user3477233


1 Answers

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);
like image 163
Ryand Avatar answered Jan 08 '26 02:01

Ryand



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!