(Winapi) I tried to create icon on runtime, but the executable's desktop icon won't change?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Briefly, I made a program that create icon from bitmap images.<br/>
<br/>
<pre>HBITMAP hbmp = (HBITMAP)::LoadImage( . . . );

//Do some operation

HICON hicon = ::CreateIconIndirect(...);

//Put them into WNDCLASSEX

WNDCLASSEX wc.hIcon = hicon;

//...
//Register classes
//...

::CreateWindowEx( .... );

//Message Loop[/code]
<br/>
It displays caption icons and alt-tab icons. However, when I build it as release, the window executable icon does not change and remain default.
From what I observe, the executable wont display any icon, if the bitmap is not presented when the EXE is launched (I coded it to load from current directory). Therefore, how do I add my own bitmap into the executable, so that this problem can be solved?
Ive been searching for all days to find out how to add raw resources without the help of resource compiler. Ive only seen codes that update resource of current EXE via other EXE.<br/>
<br/>
Also in UpdateResource : http://msdn.microsoft.com/en-us/library/ms648049(VS.85).aspx http://msdn.microsoft.com/en-us/library/ms648049(VS.85).aspx<br/>
I am very confused with the parameter lpName . The sample code use
MAKEINTRESOURCE to handle that parameter. Isnt it suppose to be the name of the file we want to add into the executable? How can
MAKEINTRESOURCE ensure us that well get to that filename?

View the full article
 
Back
Top