windows下vs开发cpp程序,判断系统版本,根据不同系统设置不同代码有效

#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
#include <Windows.h>
#include "psapi.h"
#include <process.h>
#else
#include <...>
#endif

#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
 return 1;
#else
 return 0;
#endif

系统常量

//
// _WIN32_WINNT version constants
//
#define _WIN32_WINNT_NT4                    0x0400
#define _WIN32_WINNT_WIN2K                  0x0500
#define _WIN32_WINNT_WINXP                  0x0501
#define _WIN32_WINNT_WS03                   0x0502
#define _WIN32_WINNT_WIN6                   0x0600
#define _WIN32_WINNT_VISTA                  0x0600
#define _WIN32_WINNT_WS08                   0x0600
#define _WIN32_WINNT_LONGHORN               0x0600
#define _WIN32_WINNT_WIN7                   0x0601
#define _WIN32_WINNT_WIN8                   0x0602
#define _WIN32_WINNT_WINBLUE                0x0603

猜你喜欢

转载自blog.csdn.net/weixin_43172531/article/details/106642390