A C++ Windows application desires to annotate the cursor bitmap with a small colored icon which conveys context dependent information, i.e. while hovering specific items. User preferences are to be respected, thus the system cursor must be modified instead of using an application specific cursor.
If the modified bitmap exists a new cursor can be created by a CreateIconIndirect API call.
We can create the modified bitmap by pixel manipulation of the original cursor bitmap.
We have access to the
HCURSOR
handle, e.g. by calling GetCursor (alternatives like LoadImage give similar results).By searching the internet I found a possible solutions for obtaining the original bitmap, here the problem arises:
We use GetIconInfo (or GetIconInfoExW) to retrieve its color
HBITMAP
and use GetObject to retrieve the BITMAP.The returned bitmap always has the dimensions 32x32, regardless of the DPI or the user's cursor scaling settings.
An alternative is using DrawIconEx onto a memory DC, however it seems to crudely upscale the 32x32 raster image and has inaccurate transparency pixels. Incurring loss of quality by upscaling a small raster image is not an option!
How can we get the exact cursor bitmap which is drawn onto the screen?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744698954a4588664.html
评论列表(0条)