Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add an icon for task bar? #5

Closed
ChugunovRoman opened this issue Jan 12, 2022 · 5 comments
Closed

How to add an icon for task bar? #5

ChugunovRoman opened this issue Jan 12, 2022 · 5 comments
Labels
discussion Not an issue

Comments

@ChugunovRoman
Copy link

Hi, I use go-winres in own Go Qt UI project. I added an icon for the app, and the icon display anywhere but task bar. How to fix that?
If create lnk file for binary file, the icon will be display. But if run binary directly the icon will not be display.
My res config for icon:

"RT_GROUP_ICON": {
    "APP": {
      "0000": [
        "icon.png",
        "icon.png",
        "icon.png",
        "icon.png"
      ]
    },
    "#42": {
      "0409": "icon.ico",
      "040C": "icon.ico"
    },
    "MAINICON": {
      "0409": "icon.ico"
    },
    "OTHER": {
      "0000": "icon.ico"
    }
  }

Result:

Безымянный111

@ChugunovRoman ChugunovRoman changed the title How to add an icon for task bar too? How to add an icon for task bar? Jan 13, 2022
@tc-hib
Copy link
Owner

tc-hib commented Jan 13, 2022

Hello,

It's been a long time I haven't worked on Win32 GUIs, and it was not in Go.
But I think you need to set your main window's icon with something like WM_SETICON.

I tried a console app, and Windows does that for you: it takes the first icon it finds and sets it as the console window's icon.
But in a GUI you create your own windows so you have to do it on your own.
I don't know Qt at all, maybe it has a parameter for that somewhere.

@tc-hib tc-hib added the discussion Not an issue label Jan 13, 2022
@ChugunovRoman
Copy link
Author

@tc-hib I found solution! Should have been added this in RT_GROUP_ICON in winers.json:

"IDI_ICON1": {
  "0409": "icon.ico"
}

@tc-hib
Copy link
Owner

tc-hib commented Jan 14, 2022

Hello, thanks for the feedback.

I find it strange, but who knows, that could be a default name for the window's icon. If that's the case, maybe I should talk about it in the readme.

@tc-hib
Copy link
Owner

tc-hib commented Jan 14, 2022

On a side note, I don't know if your json was the real thing, but you shouldn't use the same image several times in the same icon

Instead of

    "APP": {
      "0000": [
        "icon.png",
        "icon.png",
        "icon.png",
        "icon.png"
      ]
    }

use

    "APP": {
      "0000": "icon.png"
    }

@ChugunovRoman
Copy link
Author

ChugunovRoman commented Jan 19, 2022

On a side note, I don't know if your json was the real thing, but you shouldn't use the same image several times in the same icon

Instead of

    "APP": {
      "0000": [
        "icon.png",
        "icon.png",
        "icon.png",
        "icon.png"
      ]
    }

use

    "APP": {
      "0000": "icon.png"
    }

Hi, I removed all properties exclude IDI_ICON1. My current RT_GROUP_ICON is:

"IDI_ICON1": {
  "0409": "icon.ico"
}

It works great for any cases. The app has an icon anywhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Not an issue
Projects
None yet
Development

No branches or pull requests

2 participants