开发者

How do I add custom windows' resources into executable without resource compiler?

I was able to load a bitmap object (LoadImage) into executable (and implement it 开发者_如何学Goas an icon); however, when I release it as a standalone executable, the icon disappears. I found out that it requires the bitmap to be present in directory at runtime for this trick to work. However, my executable desktop icon will not change from default icon even with the bitmap present in current directory. I assume that this happens, because desktop icon should be determined during compiling time. Therefore, I want to know if there's a way to add resources into executable without the need of resource compiler? My desire is to have everything done with winapi. If that's not possible, then I'll consider alternatives.


You could use BeginUpdateResource, UpdateResource, and EndUpdateResource to add the bitmap resource to your executable as post-build step or something, but why avoid using the resource compiler? It's really much easier, more straightforward, and future-proof than hacking your own solution.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜