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

Recommended Answers

All 2 Replies

What error are you getting?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.