I would like to define the application icon of a Win32 window, e.g. through a call to SetClassLong
with GCL_HICON
and passing in a handle to an icon (see SetClassLong Function on MSDN).
This works great, but I have not figured out how I should load an icon (from an ICO file) in order to keep all available sizes (e.g. 16x16, 32x32, 48x48 and full size PNG icon). When I load the icon file through LoadImage
into memory to get the HICON
, I have to specify which size I want (see my reply to a related question).
My ICO file contains a small sized image which should be used as the window icon (top left corner of the title bar) and has been designed to be very crisp, but also larger variants which should show up in the Alt-Tab dialog, but...
Loading the 16x16 icon shows the proper icon in the title bar, but - of course - an ugly stretched version of it when I Alt-Tab. And the one showing up in the task bar is not very pretty either.
Loading the 48x48 icon shows a nice icon when I Alt-Tab, but the icon which shows up in the title bar is blurry, since it is a scaled down version of the 48x48 icon.
Is there any means of telling Windows that my Windows has a multi-sized icon? Is there some obvious API which I have missed?