Hello, my name is Justin! I'm currently a 3rd year Junior majoring in CSE, and I'm learning a bit about Windows programming on my own outside of class. The book I am currently reading from is "Tricks of the Windows Game Programming Gurus 2nd Edition" by Andre LaMothe. I'm on Chapter 3 right now, and I have run into some difficulty with resource files. I have been searching the internet for 3 hours (it is now 4:39am!) for a problem I have been having, yet am still unable to find a solution! After searching this forum and reading the available FAQs, I decided to post to see if I could have any luck here! I'm not sure if this is the appropriate forum for this thread, so I apologize if it isn't.

This is what I want to do: I want to make a .rc file, a corresponding .h file, a .ico file, and have my compiler link and successfully create an executable that has my personal .ico file in its place, as well as in it's upper window. From what I understand, the compiler will generate some .res file, and then linking my .h, .cpp, .rc, and .ico file, it will generate an .exe file. My program is quite simple; it simply displays a simple 400 x 400 black window. No menus, nothing else. I have successfully gotten this to work (displaying the window), I just need to be able to get the icon thing to work!

Originally, I was using Visual C++ Express Edition 2008 for this "project". After some research using google, I discovered that it doesn't support resource editing. I downloaded a tool called ResEdit, but this isn't really what I want to do. Sure, it's great for creating the .rc and respective .h files, but I want to learn to do this on my own! I looked at some other options, but for me they were a bit more complicated and time consuming that I could handle.

My next step was using Visual C++ 6.0 Standard Edition. This supported resource files, but again it seems more for creating them then simply linking them over all. I'm sure I'm over-complicating this problem, but I sure would love some help!

For reference, here is some information regarding my files:

File 1: "resource.rc"

#include "resource.h"
id_icon1 ICON star.ico

File 2: "resource.h"

#define id_icon1 100

File 3: "main.cpp"

//this is simply part of the winclass I am registering

winclass.cbSize = sizeof(WNDCLASSEX);
winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc = WindowProc; //how the messages are handled
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hinstance;
winclass.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(id_icon1));
winclass.hCursor = LoadCursor(hinstance, IDC_ARROW);
winclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
winclass.lpszMenuName = NULL;
winclass.lpszClassName = WINDOW_CLASS_NAME;
winclass.hIconSm = LoadIcon(hinstance, MAKEINTRESOURCE(id_icon1));

File 4: "star.ico"

I was quite certain to use an '#include "resource.h" in my main.cpp file. All my files, including star.ico are contained in the same directory, my "Source" folder, for either compiler. I will be quite honest; I have yet to make an executable yet (I haven't gotten that far with these new programs for me), but just simply seeing my "hIconSm" in the window would make me happy! If I can at least figure out how to get this to work, I can easily handle the rest on my own! Thank you for any time that can be offered to assist me!!!