简体   繁体   English

获取窗口图标,将其放在画布上,覆盖图像,另存为ico(WinXP和Win7)

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

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. 然后在其上放置另一个图像(徽章),然后将其另存为ico。

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. WM_GETICON获取大小图标。
  2. Convert the icon to something the loader can understand (aka. either a BITMAP or ICO). 将图标转换为加载程序可以理解的内容(即BITMAP或ICO)。 Eg How can I save HICON to an .ico file? 例如, 如何将HICON保存到.ico文件?
  3. Load the image. 加载图像。 Eg Javascript: Render PNG stored as Uint8Array onto Canvas element without Data URI 例如Javascript:在没有数据URI的情况下将存储为Uint8Array的PNG渲染到Canvas元素上
  4. canvas.drawImage
  5. canvas.mozGetAsFile ( Blob ) or canvas.mozFetchAsStream ( nsIInputStream ) using the image/vnd.microsoft.icon mime. 使用image/vnd.microsoft.icon MIME的canvas.mozGetAsFileBlob )或canvas.mozFetchAsStreamnsIInputStream )。
  6. Take the resulting data and reconstruct an icon. 获取结果数据并重建图标。
  7. LookupIconIdFromDirectoryEx and CreateIconFromResourceEx LookupIconIdFromDirectoryExCreateIconFromResourceEx
  8. WM_SETICON

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM