如下,一个支持MFC的控制台程序:在VC6下能输出hello,而在Vc2005下不行,为什么?是否VC2005在MFC上的该进?要在VC2005下输出hello,该怎么做?是否只能将CString的字符串一个个复制到一个char数组里输出?
谢谢!!!
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0; // initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
CString strHello="hello";
cout << (LPCTSTR)strHello << endl;
} return nRetCode;
}
谢谢!!!
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0; // initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
CString strHello="hello";
cout << (LPCTSTR)strHello << endl;
} return nRetCode;
}
解决方案 »
- Microsoft Visual Studio.Net(VS2005/2008)窗口颜色怎么不能改
- 可不可以在一个对话框上显示一个属性表单
- 读流文件
- 请问在VS2005的环境下,MFC自动生成的多文档,在不用CSplitterWnd的前提下,如何分割子窗口?
- 有两个非模态窗口时,如何使一个非模态窗口一直保持为当前窗口,而不让另一个非模态窗口响应鼠标事件呢?
- 怎样比较比较两个结构体数组的内容是否相同?而数组的顺序无关。
- 我用ATL做的COM,方法的参数个数超过1,用ASP调用就报错,急,急
- 如何加载popup main?
- 一种极端的情况:FindWindowsEx找不到任何窗口,keybd_event也失效!怎么办呢?
- 请问如何修改资源字符串中的文字?
- MFC activeX中如何传递自定义结构
- 可执行文件的自我更新
cout << "Hello" << endl;