Board index » cppbuilder » Extract icon from .exe

Extract icon from .exe

In the WIN32 SDK help files, there is a description of the function
ExtractIcon. With this, I should be able to get a handle to the
application's icon, directly from the executable file. Either I don't
understand it's use, or the function doesn't work. Can somebody help me?

Patrick Rotsaert

 

Re:Extract icon from .exe


Try this:

HICON icon = ExtractIcon(HInstance, "c:\\someapp.exe", 0);

Gambit

Quote
alacarte engineering <i...@alacarte-engineering.com> wrote in message

news:387ED0CE.64EDB855@alacarte-engineering.com...
Quote
> In the WIN32 SDK help files, there is a description of the function
> ExtractIcon. With this, I should be able to get a handle to the
> application's icon, directly from the executable file. Either I don't
> understand it's use, or the function doesn't work. Can somebody help me?

Re:Extract icon from .exe


Hi Patrick,

Quote
> In the WIN32 SDK help files, there is a description of the function
> ExtractIcon. With this, I should be able to get a handle to the
> application's icon, directly from the executable file. Either I don't
> understand it's use, or the function doesn't work. Can somebody help me?

Here's a simple example...

    Image1->Picture->Icon->Handle =
        ExtractIcon(HInstance, "notepad.exe", 0);    

Good luck!

--
Damon Chandler
http://bcbcaq.freeservers.com

Re:Extract icon from .exe


#include <shellapi.h>

--
Damon Chandler
http://bcbcaq.freeservers.com

Re:Extract icon from .exe


That's it, I forgot the double '\' ... shame on me !
Thanks
Quote
Remy Lebeau wrote:
> HICON icon = ExtractIcon(HInstance, "c:\\someapp.exe", 0);

Re:Extract icon from .exe


Quote
> > HICON icon = ExtractIcon(HInstance, "c:\\someapp.exe", 0);
> That's it, I forgot the double '\' ... shame on me !

Which is why you should not use the backslash at all. This works just fine and
you don't have extra typing or remembering to do:

HICON icon = ExtractIcon(HInstance, "c:/someapp.exe", 0);

+===================================================+
| Jonathan Arnold (mailto:jdarn...@buddydog.org)    |
| http://www.buddydog.org                           |
+===================================================+

You can always tell a really good idea by the enemies
it makes. -- Programmers' axiom

Other Threads