问题
Right now I change the icon of a window with this code.
What I want to do though is get the current icon in use by a window. Then put it on a canvas. Then put another image on that (a badge) then save it as ico.
回答1:
Never tried that, however the follow should work in general (with a lot of fiddling)
WM_GETICON
to get the big and small icon.- Convert the icon to something the loader can understand (aka. either a BITMAP or ICO). E.g. How can I save HICON to an .ico file?
- Load the image. E.g. Javascript: Render PNG stored as Uint8Array onto Canvas element without Data URI
canvas.drawImage
canvas.mozGetAsFile
(Blob
) orcanvas.mozFetchAsStream
(nsIInputStream
) using theimage/vnd.microsoft.icon
mime.- Take the resulting data and reconstruct an icon.
- LookupIconIdFromDirectoryEx and CreateIconFromResourceEx
WM_SETICON
来源:https://stackoverflow.com/questions/24029628/get-window-icon-put-it-on-canvas-overlay-image-save-as-ico-winxp-and-win7