admin管理员组文章数量:1391929
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?
本文标签: cWinapi Modify DPI scaled standard cursor bitmapStack Overflow
版权声明:本文标题:c++ - Winapi: Modify DPI scaled standard cursor bitmap - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744698954a2620450.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论