' -------------------------------------------------------------------------------- ' Fonction API retournant des informations sur la mémoire RAM ' -------------------------------------------------------------------------------- Declare Sub GlobalMemoryStatus _ Lib "kernel32" _ ( _ lpBuffer As MEMORYSTATUS _ ) Function Taille_RAM() As String Dim Memoire As MEMORYSTATUS GlobalMemoryStatus Memoire If Memoire.dwTotalPhys > 1024 ^ 3 Then Taille_RAM = FormatNumber((Memoire.dwTotalPhys / 1024 ^ 3), -1) & " Go" Else If Memoire.dwTotalPhys > 1024 ^ 2 Then Taille_RAM = FormatNumber((Memoire.dwTotalPhys / 1024 ^ 2), -1) & " Mo" Else If Memoire.dwTotalPhys > 1024 Then Taille_RAM = FormatNumber((Memoire.dwTotalPhys / 1024), -1) & " Ko" End If End If End If End Function
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Form_Load() Infos_Processeur MsgBox Processeur_Type MsgBox Processeur_Niveau MsgBox Processeur_Revision End Sub
' Constantes pour GetSystemInfo Private Const PROCESSOR_INTEL_386 As Long = 386 Private Const PROCESSOR_INTEL_486 As Long = 486 Private Const PROCESSOR_INTEL_PENTIUM As Long = 586 Private Const PROCESSOR_MIPS_R4000 As Long = 4000 Private Const PROCESSOR_ALPHA_21064 As Long = 21064 Private Const PROCESSOR_LEVEL_80386 As Long = 3 Private Const PROCESSOR_LEVEL_80486 As Long = 4 Private Const PROCESSOR_LEVEL_PENTIUM As Long = 5 Private Const PROCESSOR_LEVEL_PENTIUMII As Long = 6 Private Type SYSTEM_INFO dwOemID As Long dwPageSize As Long lpMinimumApplicationAddress As Long lpMaximumApplicationAddress As Long dwActiveProcessorMask As Long dwNumberOfProcessors As Long dwProcessorType As Long dwAllocationGranularity As Long wProcessorLevel As Integer wProcessorRevision As Integer End Type ' -------------------------------------------------------------------------------- ' Fonction API utilisées dans ce module ' -------------------------------------------------------------------------------- Private Declare Sub GetSystemInfo _ Lib "kernel32" _ ( _ lpSystemInfo As SYSTEM_INFO _ ) ' Variables pour retourner les valeurs du processeur Public Processeur_Type As String Public Processeur_Niveau As String Public Processeur_Revision As String Sub Infos_Processeur() Dim SI As SYSTEM_INFO Dim tmp As String Call GetSystemInfo(SI) Select Case SI.dwProcessorType Case PROCESSOR_INTEL_386: tmp = "386" Case PROCESSOR_INTEL_486: tmp = "486" Case PROCESSOR_INTEL_PENTIUM: tmp = "Pentium" Case PROCESSOR_MIPS_R4000: tmp = "MIPS 4000" Case PROCESSOR_ALPHA_21064: tmp = "Alpha" Case Else: tmp = "inconnu" End Select Processeur_Type = SI.dwProcessorType & " : " & tmp Select Case SI.wProcessorLevel Case PROCESSOR_LEVEL_80386: tmp = "Intel 80386" Case PROCESSOR_LEVEL_80486: tmp = "Intel 80486" Case PROCESSOR_LEVEL_PENTIUM: tmp = "Intel Pentium" Case PROCESSOR_LEVEL_PENTIUMII: tmp = "Intel Pentium Pro, II, III or 4" Case Else: tmp = "inconnu" End Select Processeur_Niveau = SI.wProcessorLevel & " : " & tmp Processeur_Revision = SI.wProcessorRevision & " : " & _ " Model " & " " & HiByte(SI.wProcessorRevision) & _ ", Stepping " & LoByte(SI.wProcessorRevision) End Sub Function HiByte(ByVal wParam As Integer) As Byte 'Récupération de l'octet fort HiByte = (wParam And &HFF00&) \ (&H100) End Function Function LoByte(ByVal wParam As Integer) As Byte ' Récupération de l'octet faible LoByte = wParam And &HFF& End Function