Setting an Executable's Icon (win32)

Started by
1 comment, last by KaptainKangaroo 22 years, 7 months ago
How do I do this? I have a custom icon which I want to compile into the program, to appear when you look at the exe from explorer.
Advertisement
If you are using VC++, then add a resource scruipt to your project, import your icon to the reource script, then when creating your window use this code(assuming wndClass is your window class, and ICONNAME is what you icon reource is named):

    wndClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(ICONNAME));    


Edited by - cooltomk on September 10, 2001 3:16:07 PM
Yep, I knew that. But I don''t like doing it that way. What if my application has multiple windows, and it isn''t always the same one which is registered first? What if I use a windowing library which doesn''t let me set the window''s icon? I guess that VC++ finds the first window you register, finds the icon and compiles it into your exe, so surely there must be a way to specify the icon you want to compile as your default without setting it in the source code. I know C++ Builder lets you choose, but I''m using VC++.

This topic is closed to new replies.

Advertisement