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)
And somewhere in your window create function (notice the 2 again):
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);
Just look into a .rc file generated by Devcpp (when you add an icon), you should see something like this :
A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "MyIcon.ico"
Copy-paste this line into a .rc file of your project (create one if needed) and change the filename.
It works fine with gcc, I did not try with other compilers.
Sorry to dig up an old thread, but I was searching for an answer to a similar problem, and this seems like as good a place as any to document what I found, so others may benefit. I had several ICON definitions in my RC file, and I couldn't figure out how to tell Code::Blocks which one to use as the icon for Windows Explorer. This was my code:
ID_ICON_KRAT_16 ICON "resource\\krat_16.ico"
ID_ICON_KRAT_32 ICON "resource\\krat_32.ico"
ID_ICON_KRAT_48 ICON "resource\\krat_48.ico"
I tried re-ordering the lines, and sought for some option in Code::Blocks to let me choose which icon would be used. Turns out I was looking in the wrong place. In my resdefs.hpp file I had this:
#define ID_ICON_KRAT_16 1000
#define ID_ICON_KRAT_32 1001
#define ID_ICON_KRAT_48 1002
Well, I finally tried changing the defines, and learned that the resulting EXE uses the icon with the lowest-numbered ID for its icon in Windows Explorer. I don't know if this is standard Windows behavior or just how C::B/mingw defaults, but now that I've figured it out, I'm a happy man. And maybe somebody else can benefit from my extraordinarily inefficient use of time ;)