Get window icon, put it on canvas, overlay image, save as ico (WinXP and Win7)

那年仲夏 提交于 2019-12-13 04:21:13

问题


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)

  1. WM_GETICON to get the big and small icon.
  2. 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?
  3. Load the image. E.g. Javascript: Render PNG stored as Uint8Array onto Canvas element without Data URI
  4. canvas.drawImage
  5. canvas.mozGetAsFile (Blob) or canvas.mozFetchAsStream (nsIInputStream) using the image/vnd.microsoft.icon mime.
  6. Take the resulting data and reconstruct an icon.
  7. LookupIconIdFromDirectoryEx and CreateIconFromResourceEx
  8. WM_SETICON


来源:https://stackoverflow.com/questions/24029628/get-window-icon-put-it-on-canvas-overlay-image-save-as-ico-winxp-and-win7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!