0

Hi, I am trying to compile this program:

//hello.h
#include <afxwin.h>

class CMyApp: public CWinApp
{
public:
	virtual BOOL InitInstance();
};
class CMainWindow: public CFrameWnd
{
public:
	CMainWindow();
protected:
	afx_msg void OnPaint();
	DECLARE_MESSAGE_MAP()
};
//end of hello.h
//hello.cpp
#include <afxwin.h>
#include "hello.h"

CMyApp myApp;

BOOL CMyApp::InitInstance()
{
	m_pMainWnd=new CMainWindow;
	m_pMainWnd->ShowWindow(m_nCmdShow);
	m_pMainWnd->UpdateWindow();
	return TRUE;
}

BEGIN_MESSAGE_MAP (CMainWindow,CFrameWnd)
	ON_WM_PAINT()
END_MESSAGE_MAP ()
CMainWindow::CMainWindow()
{
	Create(NULL,"the hello application"); //error
}
void CMainWindow::OnPaint()
{
	CPaintDC dc (this);
	CRect rect;
	GetClientRect (&rect);

	dc.DrawText ("hello,mfc",-1,&rect,           //error
		DT_SINGLELINE|DT_CENTER|DT_VCENTER);
}

I am trying to build first mfc program, but I get discrepencies between my book and my compiler. Is this becouse mfc 4 is no more compatible with mfc 9?
I am building this example with visual studio2010 on vista 64

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by cppgangster
0

I found out, that I have to use macro _T for string literals or I cann use just suffix L bifore literals...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.