Custom Class Registration
Posted on 2000-02-25
What I want to do is register a custom window class for a window I am creating so I can give it a menu, icon, and more importantly, change its background color. It works fine until I try to change the color, since apparently that requires registering my own class.
Anyway, every time I try to register a class with ::AfxRegisterWndClass(), it fails. I narrowed it down to that function. For some reason it simply will not register.
Am I correct in putting the registration in the CMyApp:InitInstance() function? That is where I have the class registration and CMyFrame::Create () calls. I then put the code to create child controls in CMyFrame::PreCreateWindow().
Where should I put these calls, what is the correct way to get this program rolling? I have a book (Programming Windows with MFC 2nd ed by Jeff Prosise), but when it comes to registering classes and setting up menus, icons, accelerator tables, background brushes, etc. for a window it skimps on the details.