Declare Function GetProductInfo Lib "kernel32" (ByVal dwOSMajorVersion As Long, _
ByVal dwOSMinorVersion As Long, _
ByVal dwSpMajorVersion As Long, _
ByVal dwSpMinorVersion As Long, _
ByRef pdwReturnedProductType As Long) As Long
GetProductInfo возвращает тип редакции для операционной системы на локальном компьютере.
В успешном случае функция возвращает ненулевое значение. Если лицензия пиратская или закончилась, то параметр pdwReturnedProductType получает значение PRODUCT_UNLICENSED. В случае ошибки возвращается 0
| PRODUCT_BUSINESS | 0x00000006 | Business Edition |
| PRODUCT_BUSINESS_N | 0x00000010 | Business Edition |
| PRODUCT_CLUSTER_SERVER | 0x00000012 | Cluster Server Edition |
| PRODUCT_DATACENTER_SERVER | 0x00000008 | Server Datacenter Edition (full installation) |
| PRODUCT_DATACENTER_SERVER_CORE | 0x0000000C | Server Datacenter Edition (core installation) |
| PRODUCT_DATACENTER_SERVER_CORE_V | 0x00000027 | Server Datacenter Edition without Hyper-V (core installation) |
| PRODUCT_DATACENTER_SERVER_V | 0x00000025 | Server Datacenter Edition without Hyper-V (full installation) |
| PRODUCT_ENTERPRISE | 0x00000004 | Enterprise Edition |
| PRODUCT_ENTERPRISE_N | 0x0000001B | Enterprise Edition |
| PRODUCT_ENTERPRISE_SERVER | 0x0000000A | Server Enterprise Edition (full installation) |
| PRODUCT_ENTERPRISE_SERVER_CORE | 0x0000000E | Server Enterprise Edition (core installation) |
| PRODUCT_ENTERPRISE_SERVER_CORE_V | 0x00000029 | Server Enterprise Edition without Hyper-V (core installation) |
| PRODUCT_ENTERPRISE_SERVER_IA64 | 0x0000000F | Server Enterprise Edition for Itanium-based Systems |
| PRODUCT_ENTERPRISE_SERVER_V | 0x00000026 | Server Enterprise Edition without Hyper-V (full installation) |
| PRODUCT_HOME_BASIC | 0x00000002 | Home Basic Edition |
| PRODUCT_HOME_BASIC_N | 0x00000005 | Home Basic Edition |
| PRODUCT_HOME_PREMIUM | 0x00000003 | Home Premium Edition |
| PRODUCT_HOME_PREMIUM_N | 0x0000001A | Home Premium Edition |
| PRODUCT_HOME_SERVER | 0x00000013 | Home Server Edition |
| PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT | 0x0000001E | Windows Essential Business Server Management Server |
| PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING | 0x00000020 | Windows Essential Business Server Messaging Server |
| PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY | 0x0000001F | Windows Essential Business Server Security Server |
| PRODUCT_SERVER_FOR_SMALLBUSINESS | 0x00000018 | Server for Small Business Edition |
| PRODUCT_SMALLBUSINESS_SERVER | 0x00000009 | Small Business Server |
| PRODUCT_SMALLBUSINESS_SERVER_PREMIUM | 0x00000019 | Small Business Server Premium Edition |
| PRODUCT_STANDARD_SERVER | 0x00000007 | Server Standard Edition (full installation) |
| PRODUCT_STANDARD_SERVER_CORE | 0x0000000D | Server Standard Edition (core installation) |
| PRODUCT_STANDARD_SERVER_CORE_V | 0x00000028 | Server Standard Edition without Hyper-V (core installation) |
| PRODUCT_STANDARD_SERVER_V | 0x00000024 | Server Standard Edition without Hyper-V (full installation) |
| PRODUCT_STARTER | 0x0000000B | Starter Edition |
| PRODUCT_STORAGE_ENTERPRISE_SERVER | 0x00000017 | Storage Server Enterprise Edition |
| PRODUCT_STORAGE_EXPRESS_SERVER | 0x00000014 | Storage Server Express Edition |
| PRODUCT_STORAGE_STANDARD_SERVER | 0x00000015 | Storage Server Standard Edition |
| PRODUCT_STORAGE_WORKGROUP_SERVER | 0x00000016 | Storage Server Workgroup Edition |
| PRODUCT_UNDEFINED | 0x00000000 | An unknown product |
| PRODUCT_ULTIMATE | 0x00000001 | Ultimate Edition |
| PRODUCT_ULTIMATE_N | 0x0000001C | Ultimate Edition |
| PRODUCT_WEB_SERVER | 0x00000011 | Web Server Edition (full installation) |
| PRODUCT_WEB_SERVER_CORE | 0x0000001D | Web Server Edition (core installation) |
Private Const PRODUCT_STARTER As Integer = &HB 'Starter
Private Const PRODUCT_HOME_BASIC As Integer = &H2 'Home Basic
Private Const PRODUCT_HOME_PREMIUM As Integer = &H3 'Home Premium
Private Const PRODUCT_BUSINESS As Integer = &H6 'Business
Private Const PRODUCT_ENTERPRISE As Integer = &H4 'Enterprise
Private Const PRODUCT_ULTIMATE As Integer = &H1 'Ultimate
Dim editiontype as Long
GetProductInfo(6, 0, 0, 0, editiontype)
Select Case (editiontype)
Case PRODUCT_HOME_BASIC: MsgBox("Home Basic)
Case PRODUCT_BUSINESS: MsgBox("Business)
End Select