Here's the code.
Code:
Code:
#include <afxwin.h>
// Derive essential classes.
// This is the main window class.
class CMainWin : public CFrameWnd
{
public:
CMainWin();
DECLARE_MESSAGE_MAP()
};
// Construct a window.
CMainWin::CMainWin()
{
Create(NULL, "An MFC Application Skeleton");
}
// This is the application class.
class CApp : public CWinApp
{
public:
BOOL InitInstance();
};
// Initialize the application.
BOOL CApp::InitInstance()
{
m_pMainWnd = new CMainWin;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
// This is the application's message map.
BEGIN_MESSAGE_MAP(CMainWin, CFrameWnd)
END_MESSAGE_MAP()
CApp App; // instantiate the application
Besides typing in the code, I also went into the project settings and set it to "Use MFC in a shared DLL."
When I build it, I get the following error message:
"bare_bones fatal error LNK1561: entry point must be defined"
I guess the above code works fine in VC++6, or else the book wouldn't have gotten such good reviews.
I'm just wondering, what do I have to do to make it work in .NET
Just in case you need to know, I tried the following project settings:
First, I chose "Empty Project (.NET)".
Since that didn't work, I also tried Win32 Project (Console), with the options set as follows:
Application Type: Console Application.
Add support for MFC.
Additional Options: Empty Project (Unchecked), Precompiled Header (Unchecked).
Finally, I tried "MFC Application", then deleted all header, source, and resource files and added a new source file and pasted the code in there.
None of the above worked.

Using MFC in an Empty Project
codeChaos
And actually, the book I'm looking at isn't a beginners book.
I'd looked at other MFC books but the problem was that other books tended to use the wizard, and it really bugged me to have more than a hundred lines of code which I didn't know what the heck they were doing, so I'm looking at this one which really works its way from the ground up.
NCGrimbo
(If this is the case, I'd be curious to know how it got set to "Not Set.")
It is strange that the "beginners" book would have you type in this code manually and then go on a settings goosechase to bring the configurations in line with a project that is automatically generated by the MFC Application Wizards, present in both VS6 and VS 2003.
Brian