biloon
biloon

Reputation: 435

How to load icons manually without using any resource editor?

I want to load an icon without the need of resource editors. Suppose I have the source files in the same directory as the icon files, how do I load and use it? BeginUpdateResource only update binary file that isn't currently running, while LoadIcon can only load icon file from resource inside the module. Therefore, how do I do the trick with just purely C++ alone?

PS: I just want to if there's an alternative to resource compiler, because I want to implement resource with pure C++, not by resource compiler. If there's any please tell me, I really don't want to know about any alternative resource editor (as for me, it is just an easy out of this educational scenario)

I like learning the hard way =)

Upvotes: 0

Views: 1258

Answers (2)

Marius Bancila
Marius Bancila

Reputation: 16328

You could use LoadImage for that. You'd have to set the first parameter to NULL. Example:

LoadImage(NULL, _T("youricon.ico"), IMAGE_ICON|LR_LOADFROMFILE, 0, 0, LR_DEFAULTSIZE);

Upvotes: 1

Jonathan Wood
Jonathan Wood

Reputation: 67193

Depending on what versions of Windows you need to support, you may want to use LoadImage().

Upvotes: 0

Related Questions