I also use Dev-C++ and this is the correct way to do it.
Originally posted by Sebastiani
Ok, here's what I did:
The program already generated a .rc file for the icon, I think, and so I just added that snippet to it, saved it, changed the "hwnd" to "hThisInstance"(that's my hinstance) in my program, and set the second parameter to "myBitmap". But not only does the compiler say that "myBitmap" is undeclared, but also "hThisInstance"!! I rechecked my code, and it should recognize "hThisInstance" at least. Now here's what the resource file looks like:
500 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "C:/DEV-C++/Icon/MAINICON.ICO"
myBitmap BITMAP "C//:nuntitled.bmp"
I also tried it the other way around, that is:
BITMAP myBitmap "C//:nuntitled.bmp"
...didn't work either.
In the resource file include the bitmap like this
In the source code declare a general variable for the bitmap.
myBitmap BITMAP "C:/nuntitled.bmp"
You can do it also for HINSTANCE but I prefer to get it from hWnd.
In the windows procedure include the following
HINSTANCE hInst = GetWindowLong(hWnd, GWL_HINSTANCE);
hBmp = LoadBitmap(hInst, "myBitmap");
/* Include here the functions to paint
the bitmap in the client area */