# SDL_WM_SetIcon

## Recommended Posts

When I use SDL_WM_SetIcon to set the window icon, the icon only appears in my taskbar and not in the title bar. I'm trying to find out if SDL even supports setting the icon that appears in the title bar.

##### Share on other sites
Sol Blue    139
I'm pretty sure it supports it, at least on WinXP (my platform). What are you running on?

##### Share on other sites
nooblet    167
It works for me. Make sure you have the icon loading from the right file.

Here is an example (I haven't compiled it)

SDL_Surface *screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);SDL_WM_SetCaption("Name of title", "Name of icon title");SDL_WM_SetIcon("Name of icon title", NULL);

##### Share on other sites
Phille    122
Quote:
 DescriptionSets the icon for the display window. Win32 icons must be 32x32. This function must be called before the first call to SDL_SetVideoMode. The mask is a bitmask that describes the shape of the icon. If mask is NULL, the shape is determined by the colorkey or alpha channel of the icon, if any. If neither of those are present, the icon is made opaque (no transparency). If mask is non-NULL, it points to a bitmap with bits set where the corresponding pixel should be visible. The format of the bitmap is as follows: Scanlines come in the usual top-down order. Each scanline consists of (width / 8) bytes, rounded up. The most significant bit of each byte represents the leftmost pixel.

So you have to set the icon before you set up your window.

## Create an account

Register a new account