warning C4996: 'CWinApp::Enable3dControls': CWinApp::Enable3dControls is no longer needed

来源:互联网 发布:阿里云系统盘用ssd 编辑:程序博客网 时间:2024/05/05 03:34

warning C4996: 'CWinApp::Enable3dControls': CWinApp::Enable3dControls is no longer needed.

分类: Debug 540人阅读 评论(0) 收藏 举报
cmfcmicrosoftwindowsincludedll

“CWinApp::Enable3dControls”引起的C4996告警

    这个是编译使用了老的向导生成的MFC代码时遇到的问题,一个典型的告警信息输出如下所示:

CrpFileCrack.cpp
f:\project\.....\crpfilecrack.cpp(52) : warning C4996: 'CWinApp::Enable3dControls': CWinApp::Enable3dControls is no longer needed. You should remove this call.
        e:\software\microsoft visual studio 9.0\vc\atlmfc\include\afxwin.h(4818) : see declaration of 'CWinApp::Enable3dControls'

通常向导生成的代码是:

#ifdef _AFXDLL
    Enable3dControls();            // Call this when using MFC in a shared DLL
#else
    Enable3dControlsStatic();    // Call this when linking to MFC statically
#endif

这两个函数的调用是旧的MFC版本对新版本的操作系统特性的支持,在新的(那个时候是新的)Windows 95平台上要这样调用一下才能使用新的Windows 3D样式的控件,否则就是老的Win 3.2样子的控件。想当初喜欢OWL就是因为感觉它的控件比较“酷”,比如那个带底纹的对话框,菱形的checkbox,还有带图标的“OK”按钮。对于新的MFC版本来说已经不需要再调用这两个函数了,参考前面的方法,用_MSC_VER对其隔离就行了

添加红色部分代码即可, 其他不用修改


#if _MSC_VER <= 1200 // MFC 6.0 or earlier
    #ifdef _AFXDLL
        Enable3dControls();            // Call this when using MFC in a shared DLL
    #else
        Enable3dControlsStatic();    // Call this when linking to MFC statically
    #endif
#endif


原创粉丝点击