论坛风格切换切换到宽版
  • 12阅读
  • 0回复

[易语言]取操作系统版本 [复制链接]

上一主题 下一主题
离线初音
 

使用WindowsAPI时用得到。
因为有些API在某些操作系统不兼容 或者 有些数据结构在不同操作系统时结构也不一样。
  1. .版本 2
  2. .DLL命令 RtlGetNtVersionNumbers, , "ntdll.dll", "RtlGetNtVersionNumbers"
  3.     .参数 dwMajorVer, 短整数型, 传址
  4.     .参数 dwMinorVer, 短整数型, 传址
  5.     .参数 dwBuildNumber, 短整数型, 传址

  1. .版本 2
  2. .常量 _WIN32_WINNT_NT4, "1024", 公开, Windows NT 4.0
  3. .常量 _WIN32_WINNT_WIN2K, "1280", 公开, Windows 2000
  4. .常量 _WIN32_WINNT_WINXP, "1281", 公开, Windows XP
  5. .常量 _WIN32_WINNT_WS03, "1282", 公开, Windows Server 2003
  6. .常量 _WIN32_WINNT_WIN6, "1536", 公开, Windows Vista
  7. .常量 _WIN32_WINNT_VISTA, "1536", 公开, Windows Vista
  8. .常量 _WIN32_WINNT_WS08, "1536", 公开, Windows Server 2008
  9. .常量 _WIN32_WINNT_LONGHORN, "1536", 公开, Windows Vista
  10. .常量 _WIN32_WINNT_WIN7, "1537", 公开, Windows 7
  11. .常量 _WIN32_WINNT_WIN8, "1538", 公开, Windows 8
  12. .常量 _WIN32_WINNT_WINBLUE, "1539", 公开, Windows 8.1
  13. .常量 _WIN32_WINNT_WINTHRESHOLD, "2560", 公开, Windows 10
  14. .常量 _WIN32_WINNT_WIN10, "2560", 公开, Windows 10

  1. .版本 2
  2. .子程序 WINVER, 短整数型, 公开
  3. .局部变量 s_WINVER, 短整数型, 静态, , _WIN32_WINNT
  4. .局部变量 dwMajorVer, 短整数型
  5. .局部变量 dwMinorVer, 短整数型
  6. .局部变量 dwBuildNumber, 短整数型
  7. .如果真 (s_WINVER = #NULL)
  8.     ' // _WIN32_WINNT version constants
  9.     RtlGetNtVersionNumbers (dwMajorVer, dwMinorVer, dwBuildNumber)
  10.     .判断开始 (dwMajorVer = 4 且 dwMinorVer = 0)
  11.         ' #define _WIN32_WINNT_NT4                    0x0400 // Windows NT 4.0
  12.         s_WINVER = #_WIN32_WINNT_NT4
  13.     .判断 (dwMajorVer = 5 且 dwMinorVer = 0)
  14.         ' #define _WIN32_WINNT_WIN2K                  0x0500 // Windows 2000
  15.         s_WINVER = #_WIN32_WINNT_WIN2K
  16.     .判断 (dwMajorVer = 5 且 dwMinorVer = 1)
  17.         ' #define _WIN32_WINNT_WINXP                  0x0501 // Windows XP
  18.         s_WINVER = #_WIN32_WINNT_WINXP
  19.     .判断 (dwMajorVer = 5 且 dwMinorVer = 2)
  20.         ' #define _WIN32_WINNT_WS03                   0x0502 // Windows Server 2003
  21.         s_WINVER = #_WIN32_WINNT_WS03
  22.     .判断 (dwMajorVer = 6 且 dwMinorVer = 0)
  23.         ' #define _WIN32_WINNT_WIN6                   0x0600 // Windows Vista
  24.         s_WINVER = #_WIN32_WINNT_WIN6
  25.     .判断 (dwMajorVer = 6 且 dwMinorVer = 0)
  26.         ' #define _WIN32_WINNT_VISTA                  0x0600 // Windows Vista
  27.         s_WINVER = #_WIN32_WINNT_VISTA
  28.     .判断 (dwMajorVer = 6 且 dwMinorVer = 0)
  29.         ' #define _WIN32_WINNT_WS08                   0x0600 // Windows Server 2008
  30.         s_WINVER = #_WIN32_WINNT_WS08
  31.     .判断 (dwMajorVer = 6 且 dwMinorVer = 0)
  32.         ' #define _WIN32_WINNT_LONGHORN               0x0600 // Windows Vista
  33.         s_WINVER = #_WIN32_WINNT_LONGHORN
  34.     .判断 (dwMajorVer = 6 且 dwMinorVer = 1)
  35.         ' #define _WIN32_WINNT_WIN7                   0x0601 // Windows 7
  36.         s_WINVER = #_WIN32_WINNT_WIN7
  37.     .判断 (dwMajorVer = 6 且 dwMinorVer = 2)
  38.         ' #define _WIN32_WINNT_WIN8                   0x0602 // Windows 8
  39.         s_WINVER = #_WIN32_WINNT_WIN8
  40.     .判断 (dwMajorVer = 6 且 dwMinorVer = 3)
  41.         ' #define _WIN32_WINNT_WINBLUE                0x0603 // Windows 8.1
  42.         s_WINVER = #_WIN32_WINNT_WINBLUE
  43.     .判断 (dwMajorVer = 10 且 dwMinorVer = 0)
  44.         ' #define _WIN32_WINNT_WINTHRESHOLD           0x0A00 // Windows 10
  45.         s_WINVER = #_WIN32_WINNT_WINTHRESHOLD
  46.     .判断 (dwMajorVer = 10 且 dwMinorVer = 0)
  47.         ' #define _WIN32_WINNT_WIN10                  0x0A00 // Windows 10
  48.         s_WINVER = #_WIN32_WINNT_WIN10
  49.     .默认
  50.     .判断结束
  51. .如果真结束
  52. 返回 (s_WINVER)
快速回复
限100 字节
如果您在写长篇帖子又不马上发表,建议存为草稿
 
上一个 下一个