windows.h和MFC

为什么我不能在afx(MFC)项目中包含windows.h?     
已邀请:
通常,MFC应用程序代码包括
afx.h
afxwin.h
(后者包括前者)。前两行
windows.h
#ifndef _WINDOWS_
#define _WINDOWS_
这意味着如果包含此标题,则定义
_WINDOWS_
Afx.h
包括
afxver_.h
,此标题包含
afxv_w32.h
,其中包含以下代码:
#ifdef _WINDOWS_
    #error WINDOWS.H already included. MFC apps must not #include <windows.h>
#endif
...
#include <windows.h>
因此,如果在MFC标题之前包含
windows.h
,则会在编译时产生此错误,如您所见,如果包含
afxwin.h
,则不需要自己包含
windows.h
- 它已经包含在
afxv_w32.h
中。     
因为在MFC中你不应该直接使用它。 AFAIR你应该包括afx.h,反过来间接包括windows.h正确的方式。     

要回复问题请先登录注册