Visual Basic - Api Detectar Version Windows

Life is soft - evento anual de software empresarial
 
Vista:

Api Detectar Version Windows

Publicado por Fran (1 intervención) el 11/02/2004 11:20:06
Alguien me puede pasar un codigo en Visual Basic en el que se usen las API´s de Windows para detectar la version de éste??? Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Api Detectar Version Windows

Publicado por Fernando (66 intervenciones) el 11/02/2004 13:25:04
Option Explicit

'// Used to determine the operating system.
Public Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long

'// Operating System information.
Public Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type

Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Api Detectar Version Windows

Publicado por Fernando (66 intervenciones) el 11/02/2004 13:25:31

Public Function GetOS() As String
'// Determine the operating system of the target machine.
Dim osvi As OSVERSIONINFO

osvi.dwOSVersionInfoSize = Len(osvi)
GetVersionEx osvi
Select Case osvi.dwPlatformId
Case 2 '// VER_PLATFORM_WIN32_NT.
Select Case osvi.dwMajorVersion
Case 5
Select Case osvi.dwMinorVersion
Case 0
GetOS = "Microsoft Windows 2000"
Case 1
GetOS = "Microsoft Windows XP"
Case 2
GetOS = "Microsoft Windows Server 2003 family"
End Select
Case Is <= 4
GetOS = "Microsoft Windows NT"
End Select
Case 1 '// VER_PLATFORM_WIN32_WINDOWS.
If osvi.dwMajorVersion = 4 Then
Select Case osvi.dwMinorVersion
Case 0
GetOS = "Microsoft Windows 95"
Case 10
GetOS = "Microsoft Windows 98"
Case 90
GetOS = "Microsoft Windows Millennium Edition"
End Select
End If
Case 0 '// VER_PLATFORM_WIN32s.
GetOS = "Microsoft Win32s"
End Select
End Function
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar