Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Do SFML windows ignore embedded icons?  (Read 2970 times)

0 Members and 1 Guest are viewing this topic.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Do SFML windows ignore embedded icons?
« on: July 25, 2013, 06:56:37 pm »
I have no experience with the Win32 API or anything, but I'm under the impression that when an icon is embedded in an .exe, Windows will automatically use the icons it contains in the following places (maybe more):
1) Windows Explorer
2) The Taskbar
3) The top-left corner of the application window
4) The box that appears when you hold Alt+Tab

However, when I try embedding an .ico file in my SFML program's .exe using Resource Hacker, it only appears in Windows Explorer and the Taskbar, not in the application window or the Alt-Tab box.

Is this actually standard Windows behavior, and I'm supposed to use setIcon() to get uses 3 and 4 to work?  Or is SFML actively setting its windows' icons to the OS default instead of letting Windows use the embedded icons?

I have tried setIcon(), and it does work, but it's not a complete solution because it only accepts a single array of pixels rather than an .ico file.  Since icon uses 2, 3 and 4--the ones that setIcon() seems to affect--often require different sizes, that one array of pixels ends up getting upscaled or downscaled, both of which look quite bad.  Is there some workaround for this?

I've also seen the wiki tutorial on embedding the pixel array into your source code, but that won't make the icon appear in Windows Explorer (...right?) and it can't get around the fact that getIcon() only takes one array so that doesn't seem like a solution either.

Of course, this is a very minor problem in the grand scheme of things, and aside from this I'm absolutely loving SFML as a library and am almost done with my first big program in it (which is why I'm trying to add niceties like icons now).  So I won't be devastated if there is no good general solution.

I've been using Microsoft Visual C++ 2010 Express, dynamically linking SFML for debug builds and statically linking for release builds (for some reason the debug build is unbearably slow with static linking) on Windows 7 Professional 64-bit.  Same behavior on both builds.  I've never used Mac OS X or Linux much, so I know nothing about how they deal with windows and icons, so maybe I'm unaware of some portability issues that affect this.
« Last Edit: July 25, 2013, 06:58:42 pm by Ixrec »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Do SFML windows ignore embedded icons?
« Reply #1 on: July 25, 2013, 07:35:10 pm »
Quote
Is this actually standard Windows behavior, and I'm supposed to use setIcon() to get uses 3 and 4 to work?
Yes.

Quote
that one array of pixels ends up getting upscaled or downscaled, both of which look quite bad.  Is there some workaround for this?
Not yet, SFML must be improved to support various icon sizes.
Laurent Gomila - SFML developer

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Do SFML windows ignore embedded icons?
« Reply #2 on: July 25, 2013, 09:21:12 pm »
Thanks for the quick reply.  Guess I'll skip icons for now.

 

anything