0

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.

halfer
  • 19,824
  • 17
  • 99
  • 186
Noitidart
  • 35,443
  • 37
  • 154
  • 323

1 Answers1

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
Community
  • 1
  • 1
nmaier
  • 32,336
  • 5
  • 63
  • 78