【发布时间】:2014-06-29 02:55:41
【问题描述】:
我正在尝试使用 c++ 和 mfc 制作一个简单的窗口。以下代码取自“Visual C++ and MFC Fundamentals”一书,但它不起作用。我收到错误 C2664:BOOL CFrameWnd::Create(LPCTSTR,LPCTSTR, ... ) 无法将参数 2 从 const char[20] 转换为 LPCTSTR。如何更改代码以使其正常工作?
#include <afxwin.h>
class CSimpleFrame : public CFrameWnd
{
public:
CSimpleFrame()
{
// Create the window's frame
Create(NULL, "Windows Application");
}
};
struct CSimpleApp : public CWinApp
{
BOOL InitInstance()
{
// Use a pointer to the window's frame for the application
// to use the window
CSimpleFrame *Tester = new CSimpleFrame ();
m_pMainWnd = Tester;
// Show the window
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
};
CSimpleApp theApp;
【问题讨论】:
-
Create(NULL, _T("Windows Application"));
标签: c++ visual-c++ mfc c2664