You start with an image of your icon in some image format, and convert it into a special .ico file using Visual Studio's built in icon editor.
The .ico file may contain your app's icon image in several different image resolutions (eg. 16x16, 32x32, etc), each image optimized for that size by the artist that created the image. This way the window manager can easily choose which is the best image size for the situation it needs; sometimes the window manager needs a small icon, sometimes a large one.
The .ico file is then linked into the executable as part of compiling the app. First you create a small one-line .rc file that indicates the path to the icon. This small file is then 'compiled' with the resource compiler (rc.exe, part of the Visual Studio suite of command line tools, and should already be in your PATH along with the other command line tools like cl.exe and link.exe). The resource compiler converts the .rc file into a "resource file" (.res file) which can then be added to the link line of the app, just like an .obj file.
The icon will then be shown by the window manager desktop shortcuts and file browsers whenever the .exe is referenced.
1) Start with a 32x32 .ico file, and make a copy of it. Either do a 'Search -> For Files Or Folders' for all *.ico files, or just use the "sudoku.ico" file from fltk's "test" directory. 2) Copy it to your app's icons directory. In the below example, we use ../icons.windows/foo.ico, the idea being your code layout might be: myapp/icons.windows/foo.ico <-- your icon file myapp/src/foo.cxx <-- your app myapp/src/Makefile.MICROSOFT <-- refers to ../icons.windows/foo.ico 3) Double click on the file, and open it with Visual Studio Try to use an image that has a small color map. (16 colors) 4) Fill the icon with the clear see-through background color (The blue/green icon of the 'Monitor' in the color swatch area) 5) Save your mods to the .ico file. 6) Compile the execuable with the following in your Makefile, assuming a program called 'foo', and an icons directory located in "../icons.windows": echo 101 ICON DISCARDABLE "../icons.windows/foo.ico" > foo.rc rc -r foo.rc $(CC) foo.obj foo.res $(LIBS) /subsystem:console [..] This creates a one-line foo.rc file, and compiles it into a .res "resource file" that you can then link into your app. 7) In your code, just before you show() your Fl_Window, include this line to get your icon in the window's title bar: #include <FL/x.H> // needed for fl_display #include <windows.h> // needed for LoadIcon() [..] Fl_Window *your_window = new Fl_Window(..); your_window->icon((char*)LoadIcon(fl_display, MAKEINTRESOURCE(101))); // <-- ADD THIS LINE your_window->show(); Note that the '101' in the above MAKEINTRESOURCE(101) needs to be the same value used in the foo.rc file for the ICON DISCARDABLE resource. 8) That's it! If you ever change the icon of your .exe, you may need to restart Explorer (or just reboot) in order to see the change, as sometimes the window manager will cache the old icon. Here's a complete example app that when compiled as described above will show the icon in both the title bar and the tool bar: