If we want to obtain system information with VB6.0, you can implement it through the SysInfo controls of VB6.0 and Windows API functions. First, use the SysInfo control to get the operating system version To use the SysInfo control, you must select the Microsoft SysInfo Control check box in Parts. The program code is as follows:
Private Sub Command1_ Click () Dim MsgEnd As String Select Case SysInfo1.OSPlatform Case 0 MsgEnd = "Unidentified" Case 1 MsgEnd = "Windows 95, ver." & CStr (SysInfo1.OSVersion) Case 2 MsgEnd = "Windows NT, ver." & Cstruct (sysinfo1.osversion) end select msgbox "System:" & msgend End Select Msgbox "System:" & Ms Genendendend Sub
Second, get the CPU model with the GetSystemInfo function of Windows
Form declaration code:
Private Type system-info dwoemid As Long dwpagesize As Long ipminimumapplicationaddress As Long lpmaximumapplicationaddress As Long dwactiveprocessormask As Long dwnumberofprocessors As Long dwallocationgranularity As Long dwreserved As LongEnd TypePrivate Declare Sub GetSystemInfo Lib "kernel32" (IpSystemInfo As system-info)
code:
Private sub fascist- click () DIM SYS as system-info getsysteminfo sys pattern "cpu type:"; sys.dwprocessortype profment "No.Processors:"; sys.dwnumberofprocessorsend Sub
Third, get the drive type with Windows GetDriveType function
Form declaration code:
Option ExplicitConst drive removable = 2Const drive fixed = 3Const drive remote = 4Const drive cdrom = 5Const drive ramdisk = 6Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
code:
Private Sub Command3_ Click () DIM i, DRV, D $ FOR i = 0 to 25D $ = CHR $ (i 65) & ":" DRV = GetDriveType (D $) Select Case DRV Case Drive Removable Print "Drive" & D $ & "IS Removable." Case Drive Fixed Print "Drive" & D $ & "Drive" & D $ & "IS Remote." Case Drivt CDROM Print "Drive" & D $ & "Is CD-ROME." Case Drive Ramdisk Print "Drive" & D $ & "is ramdisk." Case Else End Select Next IEND SUB creates a standard engineering, put three commands in the form New: Commandl, Command2 Command3. Click on the button with the mouse to implement the above functions.