Windows 95, 98, Me, 2000 ou XP ?

cs_MyC Messages postés 94 Date d'inscription lundi 23 septembre 2002 Statut Membre Dernière intervention 22 avril 2003 - 3 déc. 2002 à 08:33
BasicInstinct Messages postés 1470 Date d'inscription mardi 5 février 2002 Statut Membre Dernière intervention 20 octobre 2014 - 3 déc. 2002 à 14:53
Salut !

Je cherche un moyen sûr et précis permettant de trouver la version de windows installée sur un PC.
Par les API, ce n'est pas très précis, alors est-ce qu'il y a un bon moyen d'y parvenir (en passant par le registre par exemple) ?

Merci !

6 réponses

ThePsychowizard Messages postés 32 Date d'inscription mardi 26 novembre 2002 Statut Membre Dernière intervention 9 juillet 2004 1
3 déc. 2002 à 10:58
Tu veux quoi? la commande vb pour lire une cle reg ou l'endroit où tu peux trouver le nom du produit ?!!

The Psychowizard.
0
cs_MyC Messages postés 94 Date d'inscription lundi 23 septembre 2002 Statut Membre Dernière intervention 22 avril 2003
3 déc. 2002 à 13:28
L'endroit où je peux trouver le nom du produit sous n'importe quel OS !

Merci !
0
ThePsychowizard Messages postés 32 Date d'inscription mardi 26 novembre 2002 Statut Membre Dernière intervention 9 juillet 2004 1
3 déc. 2002 à 14:17
Dans le registre:
\HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\ProductName
pour win 9x

et la meme avec \WINDOWSNT\CURRENTVERSION\ProductName
pour les WINDOWS NT (et 2000 et XP)

Je sais, tu voulais pour n'importe quel windows.
Il suffit de lire les deux et de ne prendre que celle qui existe.

The Psychowizard.
0
BasicInstinct Messages postés 1470 Date d'inscription mardi 5 février 2002 Statut Membre Dernière intervention 20 octobre 2014 12
3 déc. 2002 à 14:37
'lut: Exemple de l'API Guide

'Example submitted by zeloran stronghold (zeloran@freenet.de)
'Visit his homepage at www.mosucker.de or www.mosucker.de.vu
'This example needs a form and a module.
'On the form, their should be two Labels (lbl_operatingplatform
'and lbl_operatingsystem)
'IN A FORM:
Private Sub Form_Load()
Select Case OperatingPlatform
Case Enum_OperatingPlatform.Platform_Windows_32: lbl_operatingplatform.Caption = "Windows 32"
Case Enum_OperatingPlatform.Platform_Windows_95_98_ME: lbl_operatingplatform.Caption = "Windows 95/98/ME"
Case Enum_OperatingPlatform.Platform_Windows_NT_2K_XP: lbl_operatingplatform.Caption = "Windows NT/2K"
End Select
Select Case OperatingSystem
Case System_Windows_32: lbl_operatingsystem.Caption = "Windows 32"
Case System_Windows_95: lbl_operatingsystem.Caption = "Windows 95"
Case System_Windows_98: lbl_operatingsystem.Caption = "Windows 98"
Case System_Windows_ME: lbl_operatingsystem.Caption = "Windows ME"
Case System_Windows_NT: lbl_operatingsystem.Caption = "Windows NT"
Case System_Windows_2K: lbl_operatingsystem.Caption = "Windows 2K"
Case System_Windows_XP: lbl_operatingsystem.Caption = "Windows XP"
End Select
End Sub
'IN A MODULE:
Private Declare Function GetVersionExA Lib "kernel32" (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
Public Enum Enum_OperatingPlatform
Platform_Windows_32 = 0
Platform_Windows_95_98_ME = 1
Platform_Windows_NT_2K_XP = 2
End Enum
Public Enum Enum_OperatingSystem
System_Windows_32 = 0
System_Windows_95 = 1
System_Windows_98 = 2
System_Windows_ME = 3
System_Windows_NT = 4
System_Windows_2K = 5
System_Windows_XP = 6
End Enum
Public Function OperatingPlatform() As Enum_OperatingPlatform
Dim lpVersionInformation As OSVERSIONINFO
lpVersionInformation.dwOSVersionInfoSize = Len(lpVersionInformation)
Call GetVersionExA(lpVersionInformation)
OperatingPlatform = lpVersionInformation.dwPlatformId
End Function
Public Function OperatingSystem() As Enum_OperatingSystem
Dim lpVersionInformation As OSVERSIONINFO
lpVersionInformation.dwOSVersionInfoSize = Len(lpVersionInformation)
Call GetVersionExA(lpVersionInformation)
If (lpVersionInformation.dwPlatformId = Platform_Windows_32) Then
OperatingSystem = System_Windows_32 ElseIf (lpVersionInformation.dwPlatformId Platform_Windows_95_98_ME) And (lpVersionInformation.dwMinorVersion 0) Then
OperatingSystem = System_Windows_95 ElseIf (lpVersionInformation.dwPlatformId Platform_Windows_95_98_ME) And (lpVersionInformation.dwMinorVersion 10) Then
OperatingSystem = System_Windows_98 ElseIf (lpVersionInformation.dwPlatformId Platform_Windows_95_98_ME) And (lpVersionInformation.dwMinorVersion 90) Then
OperatingSystem = System_Windows_ME
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_NT_2K_XP) And (lpVersionInformation.dwMajorVersion < 5) Then
OperatingSystem = System_Windows_NT ElseIf (lpVersionInformation.dwPlatformId Platform_Windows_NT_2K_XP) And (lpVersionInformation.dwMajorVersion 5) And (lpVersionInformation.dwMinorVersion = 0) Then
OperatingSystem = System_Windows_2K ElseIf (lpVersionInformation.dwPlatformId Platform_Windows_NT_2K_XP) And (lpVersionInformation.dwMajorVersion 5) And (lpVersionInformation.dwMinorVersion = 1) Then
OperatingSystem = System_Windows_XP
End If
End Function
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_MyC Messages postés 94 Date d'inscription lundi 23 septembre 2002 Statut Membre Dernière intervention 22 avril 2003
3 déc. 2002 à 14:52
Un grand merci à vous deux !!!!
0
BasicInstinct Messages postés 1470 Date d'inscription mardi 5 février 2002 Statut Membre Dernière intervention 20 octobre 2014 12
3 déc. 2002 à 14:53
Meme mieux

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: http://www.allapi.net/
'KPDTeam@Allapi.net
'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
0
Rejoignez-nous