Icon not showing in the Windows taskbar

I’m loading an icon in my Windows SDL app using:

SDL_Surface* pIcon = IMG_Load("icon64.png");
 
if (pIcon != NULL)
{
	SDL_SetWindowIcon(g_Window, pIcon);

	SDL_FreeSurface(pIcon);
}

When I run the app with Visual Studio, or just double click the built .exe, the icon appears in the app’s title bar and in Windows’ taskbar exactly as I’d expect. But, when I package up the app and it is installed to c:\Program Files (x86)\ and run the app from there the icon appears in the title bar but not in the taskbar (it just shows the default icon). Not sure what I’m getting wrong!

I’m using Visual Studio 2017, SDL 2.0.14 and Windows 10

1 Like

Hi,

Not sure this will help but you can try it:

  1. Convert your icon PNG image to an ICO file type.
  2. Add the new ICO icon file to your project.
  3. Create a new project file called “resources.rc”.
  4. Enter: MAINICON ICON “Icon.ico” to the new “resources.rc” file.
  5. Build and run!

Hope the above works, thanks!

Jesse

SDL_Icon-01

3 Likes

thanks for the awesome information.