Page 1 of 1

Extract a program's own icon?

Posted: Tue Feb 03, 2009 10:09 pm
by kenmo
I'm sure this has been asked and answered before, but due to vague keywords I'm having trouble searching for it.

If I compile an exe with a main icon (to appear in window's titlebar, as its explorer icon, etc) how can I extract this at runtime to also use as a tray icon?

It seems redundant to have an internal copy of the icon compiled inside, plus an external file just to be loaded for the system tray.

Suggestions?

Posted: Tue Feb 03, 2009 10:39 pm
by ts-soft

Code: Select all

Icon = LoadIcon_(GetModuleHandle_(0), 1)

Posted: Thu Feb 05, 2009 4:47 pm
by kenmo
Haven't tested yet, but thanks for the quick response ts-soft! Even easier than I assumed it was.

Posted: Tue Feb 24, 2009 6:57 pm
by milan1612
ts-soft wrote:

Code: Select all

Icon = LoadIcon_(GetModuleHandle_(0), 1)
Thanks - works well for me in combination with DrawIcon_().