|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Jul 2001
Messaggi: 367
|
Individuare il Sistema operativo
Ciao a tutti.
Volevo chiedervi se qualcuno può aiutarmi ad risolvere questo quesito: Avrei bisogno di poter determinare qualè il sistema operativo in uso, per poter così eseguire delle operazioni secondo il caso. Esempio Mi serve sapere che se il SO è qualsiasi escluso XP devo poter eseguire una determinata procedura, se invece il SO è XP ne devo eseguire un'altra. Il linguaggio che devo utilizzare è il VB6 Ciao. Carmen |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Codice:
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
Private Sub Form_Load()
Dim OSInfo As OSVERSIONINFO, PId As String
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
'[email protected]
'Set the graphical mode to persistent
Me.AutoRedraw = True
'Set the structure size
OSInfo.dwOSVersionInfoSize = Len(OSInfo)
'Get the Windows version
Ret& = GetVersionEx(OSInfo)
'Chack for errors
If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub
'Print the information to the form
Select Case OSInfo.dwPlatformId
Case 0
PId = "Windows 32s "
Case 1
PId = "Windows 95/98"
Case 2
PId = "Windows NT "
End Select
Print "OS: " + PId
Print "Win version:" + str$(OSInfo.dwMajorVersion) + "." + LTrim(str(OSInfo.dwMinorVersion))
Print "Build: " + str(OSInfo.dwBuildNumber)
End Sub
I vari sistemi operativi vengono identificati dai sequenti valori : OSVERSIONINFO.dwMajorVersion : Windows 95 4 Windows 98 4 Windows Me 4 Windows NT 3.51 3 Windows NT 4.0 4 Windows 2000 5 Whistler (Windows XP) 5 OSVERSIONINFO.dwMinorVersion : Windows 95 0 Windows 98 10 Windows Me 90 Windows NT 3.51 51 Windows NT 4.0 0 Windows 2000 0 Whistler (Windows XP) 1 In pratica se dwMajorVersion è uguale a 5 e dwMinorVersion è maggiore di 0 allora se in XP... E poi dicono che XP non è uguale al 2000...2000 è la versione 5.0 mentre XP la 5.1... Mah... |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Jul 2001
Messaggi: 367
|
Pure secondo me XP non è altro che W2000 con l'interfaccia rinnovata, gira e riggira la frittata è sempre la stessa, cambiano sempre solo qualche condimento.
Comunque grazie del codice. Proverò se non mi da problemi. Carmen |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 05:57.



















