stdafx.h和targetver.h的作用

 

stdafx.h和targetver.h的作用

1 stdafx.h作用及原理

1.1 简介

stdafx.h名称的英文全称为:Standard Application FrameworkExtensions

 

所谓头文件预编译,就是把一个工程(Project)中使用的一些MFC标准头文件(如Windows.H、Afxwin.H)预先编译,以后该工程编译时,不再编译这部分头文件,仅仅使用预编译的结果。这样可以加快编译速度,节省时间。

2 targetver.h的作用

定义程序运行的环境,如限制程序只能在XP下运行,限制程序在只能在Vin7下运行,或限制程序只能在XP以上系统运行,或限制程序只能在Server2003以上系统运行...

用法:

  

#ifndef WINVER                	  //程序中没有定义WINVER宏时

 

 

#define WINVER 0x0600            // 定义WINVER为0x0600    //0x0600表示Windows Vista

 

 

#endif

 

 

 #ifndef _WIN32_WINNT                // 程序中没有定义_WIN32_WINNT宏时

 

 

#define _WIN32_WINNT 0x0600     // 定义_WIN32_WINNT为0x0600    //0x0600表示Windows Vista

 

 

#endif

 

 附:

  

0×0500 表示Windows 2000,

 

 

0×0501为Windows XP,

 

 

0×0502为Windows Server 2003,

 

 

0×0600 为 Windows Vista。

 

 

 

 

 

参考博客:https://blog.csdn.net/google0802/article/details/9034085

posted @ 2020-04-23 13:46  巨鹿王十二  阅读(561)  评论(0)    收藏  举报