vs2005中去除Enable3dControls警告

2633阅读 0评论2010-12-02 wilsonwong
分类:C/C++

用vs2005打开vc6下实现的项目(深入浅出MFC随书光盘的文件),打开编译后会出现以下warming:

CWinApp::Enable3dControls was declared deprecated

结合网上资料,以Text(chapter 13)项目为例:

  1. /* 
  2. #ifdef _AFXDLL 
  3.         Enable3dControls();                     // Call this when using MFC in a shared DLL 
  4. #else 
  5.         Enable3dControlsStatic();       // Call this when linking to MFC statically 
  6. #endif 
  7. */  
  8. INITCOMMONCONTROLSEX InitCtrls;  
  9. InitCtrls.dwSize = sizeof(InitCtrls);  
  10. InitCtrls.dwICC = ICC_WIN95_CLASSES;  
  11. InitCommonControlsEx(&InitCtrls);  
  12. CWinApp::InitInstance();  
  13. if (!AfxOleInit())  
  14. {           AfxMessageBox("IDP_OLE_INIT_FAILED");  
  15.     return FALSE;  
  16. }  
  17. AfxEnableControlContainer();  

编译,出现AfxOleInit identifier not found error

在该文件中加入头文件

#include "afxdisp.h"

编译,通过

但是运行时,出现“未找到MFC80d.DLL”的错误

结合网上资料,此问题可能是Manifest引起的,因此我们可以通过修改项目:属性->清单工具(Manifest Tool)->输入输出(Input and Output),把“嵌入清单(Embed Manifest)”选“否(No)”

再次编译,运行,正常

另外,如果出现提示:
This application has failed to start because MSVCR80D.dll was not found. Re-installing the application may fix the problem.
可以做如下修改:
属 性->清单工具(Manifest Tool)->常规(General)->使用FAT32解决办法(Use FAT32 Work-around),选择“是(Yes)”

上一篇:冲激响应
下一篇:GetSystemMetrics用于得到被定义的系统数据或者系统配置信息