User forums > Help
Program Icon
Acki:
Hi,
I just changed to CB and it seems to be grat !!! :)
Previously I used DevCpp...
In Dev I can define the program icon in the programs settings for GUI apps!
In CB I didn't find this setting... :(
Is there a way to set the program's icon in C::B ???
Or do I have to use a recourse editor/hacker to add the icon after compiling !?!?!
thx, Acki
sethjackson:
--- Quote from: Acki on January 30, 2006, 06:20:09 pm ---Hi,
I just changed to CB and it seems to be grat !!! :)
Previously I used DevCpp...
In Dev I can define the program icon in the programs settings for GUI apps!
In CB I didn't find this setting... :(
Is there a way to set the program's icon in C::B ???
Or do I have to use a recourse editor/hacker to add the icon after compiling !?!?!
thx, Acki
--- End quote ---
No I don't think there is any setting like that.....
TDragon:
The simplest way for you to add an Explorer and shortcut icon for your program would be in a resource file.
- Create a new file with a .rc extension
- To that file, add a line like "MyIconName ICON myiconfile.ico"
- If you add the file to your project, Code::Blocks should compile correctly for you
This icon will be seen by Explorer as the first icon in your .exe and it will be used whenever the program file or a shortcut to it is displayed. Making the same icon show up in the upper left corner of your program window and in the taskbar is somewhat more complicated.
Hope that helps,
JohnE / TDM
anarxia:
The way to set application icon is dependend on the toolkit used (which is obviously what you meant).
Here's a short example for Win32 which should work for most cases:
In your rc file: (2 is arbitrary)
--- Code: ---2 ICON "myicon.ico"
--- End code ---
And somewhere in your window create function (notice the 2 again):
--- Code: ---HICON hICon;
hICon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(2));
SetClassLong(hWnd, // window handle
GCL_HICON, // changes icon
(LONG) hIcon); // The new icon
PostMessage (hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
--- End code ---
Acki:
Thanks !!! :)
I used TDragon's solution and it works !!!
Navigation
[0] Message Index
[#] Next page
Go to full version