Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
GET WINDOWS Version
Author:
chaitanya
E-mail:
Click to e-mail author
Submitted:
8/2/2006
Version:
VB6
Compatibility:
VB6
Category:
Miscellaneous
Views:
15362
Getting windos version code is open for all in MS website itself. The code is same -there is no other procedure of getting OS version from vb6 other than this.
Declarations:
Public Declare Function GetVersionExA Lib "kernel32" _ (lpVersionInformation As OSVERSIONINFO) As Integer Public Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128 End Type Public Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" (ByVal hWnd As Long, _ ByVal lpOperation As String, ByVal lpFile As String, _ ByVal lpParameters As String, ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long
Code:
Public Function getwinOS() As String Dim osinfo As OSVERSIONINFO Dim retvalue As Integer osinfo.dwOSVersionInfoSize = 148 osinfo.szCSDVersion = Space$(128) retvalue = GetVersionExA(osinfo) With osinfo Select Case .dwPlatformId Case 1 Select Case .dwMinorVersion Case 0 getversion = "Windows 95" Case 10 getversion = "Windows 98" Case 90 getversion = "Windows Millennium" End Select Case 2 Select Case .dwMajorVersion Case 3 getversion = "Windows NT 3.51" Case 4 getversion = "Windows NT 4.0" Case 5 If .dwMinorVersion = 0 Then getversion = "Windows 2000" Else getversion = "Windows XP" End If End Select Case Else getversion = "Failed" End Select End With getwinOS = UCase(getversion) End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement