DETECTAR VERSAO DO WINDOWS..

USUARIO.EXCLUIDOS 28/09/2004 00:16:20
#43696
Como que no VB eu faço para detectar a versão do windows sem dll ou ocx?
so precizava disso em meu aplicativo...
LUCASCORREA 28/09/2004 08:34:06
#43710
Resposta escolhida
Tente assim:
cole esse codigo em um form

 Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Dim Ver As String

Private Sub Form_Load()
Dim OSInfo As OSVERSIONINFO
Dim PId As String
Dim sSTR As String
Ver = ""
Me.AutoRedraw = True
OSInfo.dwOSVersionInfoSize = Len(OSInfo)
Ret& = GetVersionEx(OSInfo)
If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub
Select Case OSInfo.dwPlatformId
Case 0: PId = "Windows 32s"
Case 1: PId = "Windows 95/98"
Case 2:
If Str$(OSInfo.dwMajorVersion) <> 5 Then
PId = "Windows NT"
Else
PId = "Windows XP"
End If
End Select
sSTR = sSTR & PId
Ver = sSTR
'MsgBox sSTR
sSTR = Empty
MsgBox Ver
End Sub


Espero ter ajudado...
Tópico encerrado , respostas não são mais permitidas