开发者

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开发者_Python百科, 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 =)


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);


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜