CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: How to get the app icon?]



Chris Hill solved my problem on the newsgroup
borland.public.cppbuilder.winapi.

Tom


---- Begin included message ----
Window classes are not required to have an icon.  If you look at line
4387 of the forms.pas in the VCL source, you can see that 0 was passed
as the handle of the icon in the call to CreateWindow.  The icon is
actually set later (line 4993) using SendMessage(..., WM_SETICON, ...). 
The icon is loaded from resources.  Icons can be dynamically set.

To get the icon handle of any window, you should use 

Icon->Handle = (HICON)SendMessage(WinHandle, WM_GETICON, ICON_SMALL, 0);

Note that in the case of the application window there is no small icon,
only a large one.

Icon->Handle = (HICON) SendMessage(Application->Handle, WM_GETICON, ICON_BIG, 0);

-- 
Chris Hill
hillca@cs.purdue.edu
---- End included message ----

W Komornicki's Home Page | Main Index | Thread Index