#include <afxwin.h>
class CSimpApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};
CSimpApp theApp;
class CMainFrame : public CFrameWnd
{
public:
CMainFrame()
{
Create(NULL,”我的窗口”,WS_OVERLAPPEDWINDOW,CRect(0,0,300,200));//这里第一处
}
};
BOOL CSimpApp::InitInstance()
{
m_pMainWnd = new CMainFrame;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
m_pMainWnd->MessageBox(“你好,欢迎加入MFC世界”);//这里第二处
return TRUE;
};
用的是vc2005,上面所失两处代码编译失败,刚从vc6.0转过来,感觉不太顺,错误代码如下
正在编译…
1>SimpMFC.cpp
1> WINVER not defined. Defaulting to 0×0502 (Windows Server 2003)
1>d:\my documents\visual studio 2005\projects\first\first\simpmfc.cpp(16) : error C2664: ‘CFrameWnd::Create’ : cannot convert parameter 2 from ‘const char [9]‘ to ‘LPCTSTR’
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>d:\my documents\visual studio 2005\projects\first\first\simpmfc.cpp(26) : error C2664: ‘CWnd::MessageBoxW’ : cannot convert parameter 1 from ‘const char [22]‘ to ‘LPCTSTR’
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>生成日志保存在“file://d:\My Documents\Visual Studio 2005\Projects\first\first\Debug\BuildLog.htm”
1>first – 2 个错误,0 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========
貌似是数据类型不匹配,查了csdn也不知道问题在哪里,而且看别人这样写也好像没有问题,忘不吝赐教
>> 本文固定链接: http://www.vcgood.com/archives/3347
#include <afxwin.h>
class CSimpApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};
CSimpApp theApp;
class CMainFrame : public CFrameWnd
{
public:
CMainFrame()
{
Create(NULL,”我的窗口”,WS_OVERLAPPEDWINDOW,CRect(0,0,300,200));//这里第一处
}
};
BOOL CSimpApp::InitInstance()
{
m_pMainWnd = new CMainFrame;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
m_pMainWnd->MessageBox(“你好,欢迎加入MFC世界”);//这里第二处
return TRUE;
};
用的是vc2005,上面所失两处代码编译失败,刚从vc6.0转过来,感觉不太顺,错误代码如下
正在编译…
1>SimpMFC.cpp
1> WINVER not defined. Defaulting to 0×0502 (Windows Server 2003)
1>d:\my documents\visual studio 2005\projects\first\first\simpmfc.cpp(16) : error C2664: ‘CFrameWnd::Create’ : cannot convert parameter 2 from ‘const char [9]‘ to ‘LPCTSTR’
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>d:\my documents\visual studio 2005\projects\first\first\simpmfc.cpp(26) : error C2664: ‘CWnd::MessageBoxW’ : cannot convert parameter 1 from ‘const char [22]‘ to ‘LPCTSTR’
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>生成日志保存在“file://d:\My Documents\Visual Studio 2005\Projects\first\first\Debug\BuildLog.htm”
1>first – 2 个错误,0 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========
貌似是数据类型不匹配,查了csdn也不知道问题在哪里,而且看别人这样写也好像没有问题,忘不吝赐教
longmumin 2010-01-28 10:58:29