tc-hib / go-winres

Command line tool for adding Windows resources to executable files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to load embedded Icon via LoadIcon / LoadImage?

powellnorma opened this issue · comments

I have tried:

hModule, err := GetModuleHandle(nil)
hIcon, hModule = _LoadImage(mh, syscall.UTF16PtrFromString("APP"), 0, 0, 0)
hIcon, hModule = _LoadImage(mh, MakeIntResource(42), 0, 0, 0)

But both fail with The specified resource type cannot be found in the image file.

The winres.json file contains:

  "RT_GROUP_ICON": {
    "APP": {
      "0000": "icon_256.png",
      ]
    },
    "#42": {
      "0000": "icon_256.png"
    }
  },

Okay nvm - I forgot to add the the type parameter to the _LoadImage wrapper - Once thats added this works: _LoadImage(mh, UTF16PtrFromString("APP"), IMAGE_ICON, 0, 0, 0)