Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As _ SYSTEM_INFO)
GetSystemInfo получает информацию о текущей системе
Функция не возвращает значений
' Получим информацию о процессоре Private Const PROCESSOR_INTEL_386 = 386 Private Const PROCESSOR_INTEL_486 = 486 Private Const PROCESSOR_INTEL_PENTIUM = 586 Private Const PROCESSOR_INTEL_PENTIUM2 = 686 Private Const PROCESSOR_INTEL_PENTIUM3 = 786 Private Const PROCESSOR_MIPS_R4000 = 4000 Private Const PROCESSOR_ALPHA_21064 = 21064 Private Const PROCESSOR_ARCHITECTURE_ALPHA = 2 Private Const PROCESSOR_ARCHITECTURE_INTEL = 0 Private Const PROCESSOR_ARCHITECTURE_MIPS = 1 Private Const PROCESSOR_ARCHITECTURE_PPC = 3 Private Const PROCESSOR_ARCHITECTURE_UNKNOWN = &HFFFF Private Const VER_PLATFORM_WIN32_NT = 2 Private Const VER_PLATFORM_WIN32_WINDOWS = 1 Private Sub Command1_Click() Print GetProcessorType End Sub ' Функция для получения информации о процессоре Public Function GetProcessorType() As String Dim si As SYSTEM_INFO Dim os As OSVERSIONINFO 'retrive the Windows Platform os.dwOSVersionInfoSize = Len(os) GetVersionEx os 'retrive the SYSTEM_INFO Structure GetSystemInfo si Select Case si.wProcessorArchitecture 'Intel Architecture Case PROCESSOR_ARCHITECTURE_INTEL Select Case os.dwPlatformId Case VER_PLATFORM_WIN32_NT Select Case si.wProcessorLevel Case 3 GetProcessorType = "Intel 80386" If (si.wProcessorRevision And &HFF00) = &HFF00 Then GetProcessorType = GetProcessorType And " Model " & ((si.wProcessorRevision And &HF0) / &HF) - 10 & " Stepping " & (si.wProcessorRevision And &HF) Else GetProcessorType = GetProcessorType And " Stepping " & Chr(Asc("A") + (si.wProcessorRevision And &HFF) / &HFF) & " Stepping " & (si.wProcessorRevision And &HFF) End If Case 4 GetProcessorType = "Intel 80486" If (si.wProcessorRevision And &HFF00) = &HFF00 Then GetProcessorType = GetProcessorType And " Model " & ((si.wProcessorRevision And &HF0) / &HF) - 10 & " Stepping " & (si.wProcessorRevision And &HF) Else GetProcessorType = GetProcessorType And " Stepping " & Chr(Asc("A") + (si.wProcessorRevision And &HFF) / &HFF) & " Stepping " & (si.wProcessorRevision And &HFF) End If Case 5 GetProcessorType = "Pentium Model " & (si.wProcessorRevision And &HFF00) \ &HFF & " Stepping " & (si.wProcessorRevision And &HFF) Case 6 GetProcessorType = "Pentium II Model " & (si.wProcessorRevision And &HFF00) \ &HFF & " Stepping " & (si.wProcessorRevision And &HFF) Case 7 GetProcessorType = "Pentium III Model " & (si.wProcessorRevision And &HFF00) \ &HFF & " Stepping " & (si.wProcessorRevision And &HFF) End Select Case VER_PLATFORM_WIN32_WINDOWS Select Case si.dwProcessorType Case PROCESSOR_INTEL_386 GetProcessorType = "Intel 80386" Case PROCESSOR_INTEL_486 GetProcessorType = "Intel 80486" Case PROCESSOR_INTEL_PENTIUM GetProcessorType = "Pentium" Case PROCESSOR_INTEL_PENTIUM2 GetProcessorType = "Pentium II" Case PROCESSOR_INTEL_PENTIUM3 GetProcessorType = "Pentium III" End Select End Select 'MIPS Architecture (only for WinNT) Case PROCESSOR_ARCHITECTURE_MIPS GetProcessorType = "MIPS R" & si.wProcessorLevel & "000" 'ALPHA Architecture (only for WinNT) Case PROCESSOR_ARCHITECTURE_ALPHA GetProcessorType = "Alpha " & si.wProcessorLevel & " Model A" & (si.wProcessorRevision And &HFF00) \ &HFF & " Pass " & (si.wProcessorRevision And &HFF) 'PPC Architecture (only for WinNT) Case PROCESSOR_ARCHITECTURE_PPC Select Case si.wProcessorLevel Case 1, 3, 4, 20 GetProcessorType = "PPC 6" & Format(si.wProcessorLevel, "00") Case 6 GetProcessorType = "PPC 603+" Case 9 GetProcessorType = "PPC 604+" End Select GetProcessorType = GetProcessorType & " Processor Version " & (si.wProcessorRevision And &HFF00) \ &HFF & "." & (si.wProcessorRevision And &HFF) End Select End Function