VB及VBA穫取操作繫統版本的通用模塊
- 2017-09-19 08:00:00
- zstmtony 原創
- 3565
VB及VBA穫取操作繫統版本的通用模塊
Option Explicit Public OSNameAs String'操作繫統名稱(簡稱),方便程序控製時根據操作繫統取值 Public Type OSVERSIONINFO dwOSVersionInfoSize AsLong dwMajorVersion AsLong dwMinorVersion AsLong dwBuildNumber AsLong dwPlatformId AsLong szCSDVersion AsString * 128 wServicePackMajor AsInteger wServicePackMinor AsInteger wSuiteMask AsInteger wProductType AsByte wReserved AsByte End Type Public Declare Function GetVersionExLib "kernel32"Alias "GetVersionExA" (lpVersionInformationAs OSVERSIONINFO)As Long ' 穫得 Windows 操作繫統的名稱,returnType決定返迴的方式,值爲0時,返迴簡稱,否則返迴全稱 Public Function GetWindowsVersion(ByVal returnTypeAs Integer)As String Dim ver As OSVERSIONINFO, retLngAs Long, osAs String ver.dwOSVersionInfoSize =Len(ver) GetVersionEx ver ' retLng = GetVersionEx(ver) ' If retLng = 0 Then ' os = "Unknown System Version!" ' Exit Function ' End If With ver SelectCase .dwPlatformId Case1 SelectCase .dwMinorVersion Case0 If returnType= 0Then os ="Windows 95" Else SelectCase .szCSDVersion Case"C" os ="Windows 95 OSR2" Case"B" os ="Windows 95 OSR2" CaseElse os ="Windows 95" EndSelect EndIf Case10 If returnType= 0Then os ="Windows 98" Else SelectCase .szCSDVersion Case"A" os ="Windows 98 SE" CaseElse os ="Windows 98" EndSelect EndIf Case90 If returnType= 0Then os ="Windows Me" Else os ="Windows Millennium Edition" EndIf EndSelect Case2 SelectCase .dwMajorVersion Case3 os ="Windows NT 3.51" Case4 os ="Windows NT 4.0" Case5 SelectCase .dwMinorVersion Case0 If returnType= 0Then os ="Windows 2000" Else SelectCase .wSuiteMask Case&H80 os ="Windows 2000 Data center" Case&H2 os ="Windows 2000 Advanced" CaseElse os ="Windows 2000" EndSelect EndIf Case1 If returnType= 0Then os ="Windows XP" Else SelectCase .wSuiteMask Case&H0 os ="Windows XP Professional" Case&H200 os ="Windows XP Home" CaseElse os ="Windows XP" EndSelect EndIf Case2 If returnType= 0Then os ="Windows Server 2003" Else SelectCase .wSuiteMask Case&H2 os ="Windows Server 2003 Enterprise" Case&H80 os ="Windows Server 2003 Data center" Case&H400 os ="Windows Server 2003 Web Edition" Case&H0 os ="Windows Server 2003 Standard" ' Case &H112 ' os = "Windows Server 2003 R2 Enterprise" Case Else os ="Windows Server 2003" EndSelect EndIf EndSelect If returnType<> 0And .wServicePackMajor> 0Then os = os& " Service Pack" & .wServicePackMajor& IIf(.wServicePackMinor> 0,"."& .wServicePackMinor, vbNullString) EndIf Case6 If returnType<> 0Then SelectCase .wProductType Case&H6 os ="Business Edition" Case&H10 os ="Business Edition (N)" Case&H12 os ="Cluster Server Edition" Case&H8 os ="Server Datacenter Edition (full installation)" Case&HC os ="Server Datacenter Edition (core installation)" Case&H4 os ="Enterprise Edition" Case&H1B os ="Enterprise Edition (N)" Case&HA os ="Server Enterprise Edition (full installation)" Case&HE os ="Server Enterprise Edition (core installation)" Case&HF os ="Server Enterprise Edition for Itanium-based Systems" Case&H2 os ="Home Basic Edition" Case&H5 os ="Home Basic Edition (N)" Case&H3 os ="Home Premium Edition" Case&H1A os ="Home Premium Edition (N)" Case&H13 os ="Home Server Edition" Case&H18 os ="Server for Small Business Edition" Case&H9 os ="Small Business Server" Case&H19 os ="Small Business Server Premium Edition" Case&H7 os ="Server Standard Edition (full installation)" Case&HD os ="Server Standard Edition (core installation)" Case&H8 os ="Starter Edition" Case&H17 os ="Storage Server Enterprise Edition" Case&H14 os ="Storage Server Express Edition" Case&H15 os ="Storage Server Standard Edition" Case&H16 os ="Storage Server Workgroup Edition" Case&H1 os ="Ultimate Edition" Case&H1C os ="Ultimate Edition (N)" Case&H0 os ="An unknown product" Case&HABCDABCD os ="Not activated product" Case&H11 os ="Web Server Edition" EndSelect EndIf SelectCase .dwMinorVersion Case0 SelectCase .wProductType Case3 If returnType= 0Then os ="Windows Server 2008" Else os ="Windows Server 2008" & os EndIf CaseElse If returnType= 0Then os ="Windows Vista" Else os ="Windows Vista " & os EndIf EndSelect Case1 SelectCase .wProductType Case3 If returnType= 0Then os ="Windows Server 2008 R2" Else os ="Windows Server 2008 R2"& os EndIf CaseElse If returnType= 0Then os ="Windows 7" Else os ="Windows 7 " & os EndIf EndSelect EndSelect If returnType<> 0And .wServicePackMajor> 0Then os = os& " Service Pack" & .wServicePackMajor& IIf(.wServicePackMinor> 0,"."& .wServicePackMinor, vbNullString) EndIf EndSelect CaseElse os ="Unknown System Version!" End Select If returnType<> 0Then os = os &" [Version: " & .dwMajorVersion& "."& .dwMinorVersion& "."& .dwBuildNumber& "]" End With GetWindowsVersion = os End Function '返迴穫取本地連接屬性的方式 'Vista及Win7下 GetDetailsOf(FolderItem, 2) 穫取的值類似於:“Marvell Yukon 88E8056 PCI-E Gigabit Ethernet Controller”,對應XP、2000及2003下的GetDetailsOf(FolderItem, 3) 'Vista及Win7下 GetDetailsOf(FolderItem, 1) 穫取的值爲本地連接狀態,爲“網絡”時説明正常,對應XP、2000及2003下的GetDetailsOf(FolderItem, 2) Public Function getAdapterStatusType()As Integer Select Case OSName Case "Windows Vista","Windows Server 2008","Windows 7","Windows Server 2008 R2" getAdapterStatusType =2 Case Else getAdapterStatusType =3 End Select End Function '返迴穫取本地連接屬性的方式 'Vista及Win7下 GetDetailsOf(FolderItem, 2) 穫取的值類似於:“Marvell Yukon 88E8056 PCI-E Gigabit Ethernet Controller”,對應XP、2000及2003下的GetDetailsOf(FolderItem, 3) 'Vista及Win7下 GetDetailsOf(FolderItem, 1) 穫取的值爲本地連接狀態,爲“網絡”時説明正常,對應XP、2000及2003下的GetDetailsOf(FolderItem, 2) Public Function getAdapterStatusType()As Integer Select Case OSName Case "Windows Vista","Windows Server 2008","Windows 7","Windows Server 2008 R2" getAdapterStatusType =2 Case Else getAdapterStatusType =3 End Select End Function
Access數據庫自身
- office課程播放地址及課程明細
- Excel Word PPT Access VBA等Office技巧學習平颱
- 將( .accdb) 文件格式數據庫轉換爲早期版本(.mdb)的文件格式
- 將早期的數據庫文件格式(.mdb)轉換爲 (.accdb) 文件格式
- KB5002984:配置 Jet Red Database Engine 數據庫引擎和訪問連接引擎以阻止對遠程數據庫的訪問(remote table)
- Access 365 /Access 2019 數據庫中哪些函數功能和屬性被沙箱模式阻止(如未啟動宏時)
- Access Runtime(運行時)最全的下載(2007 2010 2013 2016 2019 Access 365)
Access Activex第三方控件
- Activex控件或Dll 在某些電腦無法正常註冊的解決辦法(regsvr32註冊時卡住)
- office使用部分控件時提示“您沒有使用該ActiveX控件許可的問題”的解決方法
- RTF文件(富文本格式)的一些解析
- Access樹控件(treeview) 64位Office下齣現橫曏滾動條不會自動定位的解決辦法
- Access中國樹控件 在win10電腦 節點行間距太小的解決辦法
- EXCEL 2019 64位版(Office 2019 64位)早就支持64位Treeview 樹控件 ListView列錶等64位MSCOMMCTL.OCX控件下載
- VBA或VB6調用WebService(直接Post方式)併解析返迴的XML
Access ADP Sql Server等
- 早期PB程序連接Sqlserver齣現錯誤
- MMC 不能打開文件C:/Program Files/Microsoft SQL Server/80/Tools/Binn/SQL Server Enterprise Manager.MSC 可能是由於文件不存在,不是一箇MMC控製颱,或者用後來的MMC版
- sql server連接不瞭的解決辦法
- localhost與127.0.0.1區彆
- Roych的淺談數據庫開髮繫列(Sql Server)
- sqlserver 自動備份對備份目録沒有存取權限的解決辦法
- 安裝Sql server 2005 express 和SQLServer2005 Express版企業管理器 SQLServer2005_SSMSEE
文章分類
聯繫我們
聯繫人: | 王先生 |
---|---|
Email: | 18449932@qq.com |
QQ: | 18449932 |
微博: | officecn01 |