home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / windows / sysinfo / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-04-27  |  15.7 KB  |  493 lines

  1. VERSION 2.00
  2. Begin Form Main 
  3.    BackColor       =   &H00808080&
  4.    Caption         =   "System Info DLL Demo"
  5.    DrawStyle       =   1  'Transparent
  6.    Height          =   4665
  7.    Icon            =   0
  8.    KeyPreview      =   -1  'True
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4260
  12.    ScaleWidth      =   7365
  13.    Top             =   1140
  14.    Width           =   7485
  15.    Begin Frame Frame1 
  16.       BackColor       =   &H00C0C0C0&
  17.       Caption         =   "About..."
  18.       Height          =   3375
  19.       Left            =   240
  20.       TabIndex        =   5
  21.       Top             =   360
  22.       Width           =   5175
  23.       Begin Label Label12 
  24.          BackColor       =   &H00C0C0C0&
  25.          Height          =   255
  26.          Left            =   120
  27.          TabIndex        =   17
  28.          Top             =   3000
  29.          Width           =   4935
  30.       End
  31.       Begin Label Label11 
  32.          BackColor       =   &H00C0C0C0&
  33.          Height          =   255
  34.          Left            =   120
  35.          TabIndex        =   16
  36.          Top             =   2760
  37.          Width           =   4935
  38.       End
  39.       Begin Label Label10 
  40.          BackColor       =   &H00C0C0C0&
  41.          Height          =   255
  42.          Left            =   120
  43.          TabIndex        =   15
  44.          Top             =   2520
  45.          Width           =   4935
  46.       End
  47.       Begin Label Label9 
  48.          BackColor       =   &H00C0C0C0&
  49.          Height          =   255
  50.          Left            =   120
  51.          TabIndex        =   14
  52.          Top             =   2280
  53.          Width           =   4935
  54.       End
  55.       Begin Label Label8 
  56.          BackColor       =   &H00C0C0C0&
  57.          Height          =   255
  58.          Left            =   120
  59.          TabIndex        =   13
  60.          Top             =   2040
  61.          Width           =   4935
  62.       End
  63.       Begin Label Label7 
  64.          BackColor       =   &H00C0C0C0&
  65.          Height          =   255
  66.          Left            =   120
  67.          TabIndex        =   12
  68.          Top             =   1800
  69.          Width           =   4935
  70.       End
  71.       Begin Label Label6 
  72.          BackColor       =   &H00C0C0C0&
  73.          Height          =   255
  74.          Left            =   120
  75.          TabIndex        =   11
  76.          Top             =   1560
  77.          Width           =   4935
  78.       End
  79.       Begin Label Label5 
  80.          BackColor       =   &H00C0C0C0&
  81.          Height          =   255
  82.          Left            =   120
  83.          TabIndex        =   10
  84.          Top             =   1320
  85.          Width           =   4935
  86.       End
  87.       Begin Label Label4 
  88.          BackColor       =   &H00C0C0C0&
  89.          Height          =   255
  90.          Left            =   120
  91.          TabIndex        =   9
  92.          Top             =   1080
  93.          Width           =   4935
  94.       End
  95.       Begin Label Label3 
  96.          BackColor       =   &H00C0C0C0&
  97.          Height          =   255
  98.          Left            =   120
  99.          TabIndex        =   8
  100.          Top             =   840
  101.          Width           =   4935
  102.       End
  103.       Begin Label Label2 
  104.          BackColor       =   &H00C0C0C0&
  105.          Height          =   255
  106.          Left            =   120
  107.          TabIndex        =   7
  108.          Top             =   600
  109.          Width           =   4935
  110.       End
  111.       Begin Label Label1 
  112.          BackColor       =   &H00C0C0C0&
  113.          Height          =   255
  114.          Left            =   120
  115.          TabIndex        =   6
  116.          Top             =   360
  117.          Width           =   4935
  118.       End
  119.    End
  120.    Begin CommandButton Network 
  121.       Caption         =   "Network"
  122.       Height          =   495
  123.       Left            =   5760
  124.       TabIndex        =   4
  125.       Top             =   3000
  126.       Width           =   1095
  127.    End
  128.    Begin CommandButton Windows 
  129.       Caption         =   "Windows"
  130.       Height          =   495
  131.       Left            =   5760
  132.       TabIndex        =   3
  133.       Top             =   2400
  134.       Width           =   1095
  135.    End
  136.    Begin CommandButton Drives 
  137.       Caption         =   "Drives"
  138.       Height          =   495
  139.       Left            =   5760
  140.       TabIndex        =   2
  141.       Top             =   1800
  142.       Width           =   1095
  143.    End
  144.    Begin CommandButton Video 
  145.       Caption         =   "Video"
  146.       Height          =   495
  147.       Left            =   5760
  148.       TabIndex        =   1
  149.       Top             =   1200
  150.       Width           =   1095
  151.    End
  152.    Begin CommandButton CPU 
  153.       Caption         =   "CPU"
  154.       Height          =   495
  155.       Left            =   5760
  156.       TabIndex        =   0
  157.       Top             =   600
  158.       Width           =   1095
  159.    End
  160. Sub ClrWin ()
  161.   Label1.Caption = ""
  162.   Label2.Caption = ""
  163.   Label3.Caption = ""
  164.   Label4.Caption = ""
  165.   Label5.Caption = ""
  166.   Label6.Caption = ""
  167.   Label7.Caption = ""
  168.   Label8.Caption = ""
  169.   Label9.Caption = ""
  170.   Label10.Caption = ""
  171.   Label11.Caption = ""
  172.   Label12.Caption = ""
  173. End Sub
  174. Sub CPU_Click ()
  175.   Dim WinFlags As Long
  176.   Dim Avail As Long, FreeSpace As Long
  177.   Dim Major As Integer, Minor As Integer, Mouse As Integer, IRQ As Integer
  178.   Dim Model As Integer, Submodel As Integer, Rev As Integer
  179.   Dim M As String, S As String, R As String
  180.   Call ClrWin
  181.   Frame1.Caption = "CPU Info..."
  182.   WinFlags = GetWinFlags()
  183.   'get model I.D.
  184.   Call GetID(Model, Submodel, Rev)
  185.   'display model type
  186.   Label1.Caption = "Model Type: "
  187.   Select Case Model
  188.     Case &HFF
  189.       Label1.Caption = Label1.Caption & "IBM PC or compatible"
  190.     Case &HFE
  191.       Label1.Caption = Label1.Caption & "IBM PC/XT or compatible"
  192.     Case &HFC
  193.       Select Case Submodel
  194.     Case &H2
  195.       Label1.Caption = Label1.Caption & "IBM XT-286"
  196.     Case &H4, &H5, &H9
  197.       Label1.Caption = Label1.Caption & "PS/2"
  198.     Case &HB
  199.       Label1.Caption = Label1.Caption & "PS/1"
  200.     Case Else
  201.       Label1.Caption = Label1.Caption & "IBM AT or compatible"
  202.       End Select
  203.     Case &HFB
  204.       Label1.Caption = Label1.Caption & "IBM PC/XT or compatible"
  205.     Case &HFA
  206.       Label1.Caption = Label1.Caption & "PS/1"
  207.     Case &HF9
  208.       Label1.Caption = Label1.Caption & "PC Convertible"
  209.     Case &HF8
  210.       Select Case Submodel
  211.     Case &HE, &HF, &H30
  212.       Label1.Caption = Label1.Caption & "PS/1"
  213.     Case &H1F, &H49, &H4A, &H4B
  214.       Label1.Caption = Label1.Caption & "PS/ValuePoint"
  215.     Case &H5E
  216.       Label1.Caption = Label1.Caption & "IBM Thinkpad"
  217.     Case Else
  218.       Label1.Caption = Label1.Caption & "PS/2"
  219.     End Select
  220.     Case &HE1
  221.       Label1.Caption = Label1.Caption & "PS/2"
  222.     Case Else
  223.       Label1.Caption = Label1.Caption & "Unknown model"
  224.   End Select
  225.   'display I.D. bytes
  226.   M = Hex$(Model)
  227.   S = Hex$(Submode)
  228.   R = Hex$(Rev)
  229.   If Len(M) < 2 Then M = "0" & M
  230.   If Len(S) < 2 Then S = "0" & S
  231.   If Len(R) < 2 Then R = "0" & R
  232.   Label2.Caption = "Model I.D. Bytes: " & M & " " & S & " " & R
  233.   'display CPU type
  234.   Label4.Caption = "CPU Type: "
  235.   If WinFlags And WF_CPU086 Then
  236.   Label4.Caption = Label4.Caption & "8086"
  237.   ElseIf WinFlags And WF_CPU186 Then
  238.     Label4.Caption = Label4.Caption & "80186"
  239.   ElseIf WinFlags And WF_CPU286 Then
  240.     Label4.Caption = Label4.Caption & "80286"
  241.   ElseIf WinFlags And WF_CPU386 Then
  242.     Label4.Caption = Label4.Caption & "80386"
  243.   ElseIf WinFlags And WF_CPU486 Then
  244.     Label4.Caption = Label4.Caption & "80486"
  245.   Else
  246.     Label4.Caption = Label4.Caption & "Unknown"
  247.   End If
  248.   If WinFlags And WF_80x87 Then Label4.Caption = Label4.Caption & " (Math coprocessor present)"
  249.   'get number of serial and parallel ports
  250.   Label6.Caption = "Serial Ports   : " & Str$(GetSerial())
  251.   Label7.Caption = "Parallel Ports  : " & Str$(GetParallel())
  252.   'get available memory
  253.   Avail = GetFreeSpace(0)
  254.   If Sgn(Avail) = -1 Then
  255.     FreeSpace = CLng(Avail + 1&) Xor &HFFFFFFFF
  256.   Else
  257.     FreeSpace = Avail
  258.   End If
  259.   Label9.Caption = "Available Memory: " & Str$(FreeSpace) & " bytes"
  260.   'get mouse info
  261.   If GetMouseInfo(Major, Minor, Mouse, IRQ) Then
  262.     Label11.Caption = "Mouse Driver Version " & Str$(Major) & "." & Str$(Minor)
  263.     Label12.Caption = "Mouse Type: "
  264.     Select Case Mouse
  265.       Case 1:
  266.     Label12.Caption = Label12.Caption & "Bus Mouse" & " (Using IRQ " & Str$(IRQ) & ")"
  267.       Case 2:
  268.     Label12.Caption = Label12.Caption & "Serial Mouse" & " (Using IRQ " & Str$(IRQ) & ")"
  269.       Case 3:
  270.     Label12.Caption = Label12.Caption & "Inport Mouse" & " (Using IRQ " & Str$(IRQ) & ")"
  271.       Case 4:
  272.     Label12.Caption = Label12.Caption & "PS/2 Mouse"
  273.       Case 5:
  274.     Label12.Caption = Label12.Caption & "Hewlett-Packard Mouse" & " (Using IRQ " & Str$(IRQ) & ")"
  275.       End Select
  276.   Else
  277.     Label11.Caption = "Mouse Driver Not Installed."
  278.   End If
  279. End Sub
  280. Sub Drives_Click ()
  281.   Dim ClusSize As Long, Avail As Long
  282.   Dim a As Integer, b As Integer
  283.   Dim Major As Integer, Minor As Integer
  284.   Dim Drive As String
  285.   Call ClrWin
  286.   Frame1.Caption = "Drive Info..."
  287.   'check for SmartDrive
  288.   If ChkSmartDrv() Then
  289.     Label1.Caption = "SmartDrive installed"
  290.   Else
  291.     Label1.Caption = "SmartDrive not installed"
  292.   End If
  293.   'check for DblSpace
  294.   If ChkDblSpace() Then
  295.     Label2.Caption = "DblSpace installed"
  296.   Else
  297.     Label2.Caption = "DblSpace not installed"
  298.   End If
  299.   'check for MSCDEX CD-ROM extension
  300.   If GetMSCDEX(Major, Minor) Then
  301.     Label3.Caption = "MSCDEX installed (Version " & Str$(Major) & "." & Str$(Minor) & ")"
  302.   Else
  303.     Label3.Caption = "MSCDEX not installed"
  304.   End If
  305.   'get floppy drive info
  306.   If Not GetFloppyDrvs(a, b) Then
  307.     Select Case a
  308.       Case 0:
  309.     Label5.Caption = "Drive A: Not installed"
  310.       Case 1:
  311.     Label5.Caption = "Drive A: 360K DD"
  312.       Case 2:
  313.     Label5.Caption = "Drive A: 1.2M HD"
  314.       Case 3:
  315.     Label5.Caption = "Drive A: 720K DD"
  316.       Case 4:
  317.     Label5.Caption = "Drive A: 1.44M HD"
  318.       Case 5:
  319.     Label5.Caption = "Drive A: 2.88M ED"
  320.       Case Else
  321.     Label5.Caption = "Drive A: Unknown"
  322.     End Select
  323.     Select Case b
  324.       Case 0:
  325.     Label6.Caption = "Drive B: Not installed"
  326.       Case 1:
  327.     Label6.Caption = "Drive B: 360K DD"
  328.       Case 2:
  329.     Label6.Caption = "Drive B: 1.2M HD"
  330.       Case 3:
  331.     Label6.Caption = "Drive B: 720K DD"
  332.       Case 4:
  333.     Label6.Caption = "Drive B: 1.44M HD"
  334.       Case 5:
  335.     Label6.Caption = "Drive B: 2.88M ED"
  336.       Case Else
  337.     Label6.Caption = "Drive B: Unknown"
  338.     End Select
  339.   End If
  340.   'display current drive info
  341.   If Not GetDrvSpace(0, SecPerClus&, FreeClus&, BytesPerSec&, TotalClus&) Then
  342.     ClusSize& = BytesPerSec& * SecPerClus&
  343.     Free& = FreeClus& * ClusSize&
  344.     Drive = Left$(CurDir$, 1)
  345.     Label8.Caption = "Current Drive = " & Drive & ":"
  346.     If IsDblSPace(Asc(Drive) - 65) Then
  347.       Label8.Caption = Label8.Caption & "   (DblSpace)"
  348.     End If
  349.     Label9.Caption = "  Available Space: " & Free& & " bytes"
  350.   End If
  351.   'get lastdrive
  352.   Label11.Caption = "Lastdrive = " & Chr$(GetLastDrv() + 64)
  353. End Sub
  354. Sub Form_Load ()
  355.   Label1.Caption = "                       System Info DLL Demo"
  356.   Label2.Caption = "                           For Visual Basic  "
  357.   Label6.Caption = "                              Version 1.00   "
  358.   Label10.Caption = " This Library is Copyrighted (C) 1994 By Paul Lapsansky"
  359.   Label11.Caption = "                      ALL RIGHTS RESERVED"
  360. End Sub
  361. Sub Network_Click ()
  362.   Dim Major As Integer, Minor As Integer, Rev As Integer, Mem As Integer
  363.   Call ClrWin
  364.   Frame1.Caption = "Network Info..."
  365.   'check for IPX
  366.   If ChkIPX() Then
  367.     Label1.Caption = "Novell IPX Installed"
  368.   Else
  369.     Label1.Caption = "Novell IPX Not Installed"
  370.   End If
  371.   If GetNetShellInfo(Major, Minor, Rev, Mem) Then
  372.     Label3.Caption = "Novell NetShell Version " & Str$(Major) & "." & Str$(Minor) & "." & Str$(Rev) & " installed"
  373.     Select Case Mem
  374.       Case 1:
  375.     Label4.Caption = "    NetShell Loaded in EMS Memory"
  376.       Case 2:
  377.     Label4.Caption = "    NetShell Loaded in XMS Memory"
  378.       Case Else
  379.     Label4.Caption = "    NetShell Loaded in Conventional Memory"
  380.     End Select
  381.   Else
  382.     Label3.Caption = "Novell NetShell Not Installed"
  383.   End If
  384. End Sub
  385. Sub Video_Click ()
  386.   Dim Card As Integer
  387.   Call ClrWin
  388.   Frame1.Caption = "Video Info..."
  389.   'get video card type
  390.   Card = GetVidType()
  391.   Label1.Caption = "Video Adapter: "
  392.   Select Case Card
  393.     Case 1:
  394.       Label1.Caption = Label1.Caption & "Hercules Monochrome Graphics"
  395.     Case 2:
  396.       Label1.Caption = Label1.Caption & "CGA - Color Graphics Adapter"
  397.     Case 3:
  398.       Label1.Caption = Label1.Caption & "EGA - Enhanced Graphics Adapter"
  399.       If GetCrtType() Then
  400.     Label1.Caption = Label1.Caption & " (Monochrome)"
  401.       Else
  402.     Label1.Caption = Label1.Caption & " (Color)"
  403.       End If
  404.     Case 4:
  405.       Label1.Caption = Label1.Caption & "VGA - Video Graphics Array"
  406.       If GetCrtType() Then
  407.     Label1.Caption = Label1.Caption & " (Monochrome)"
  408.       Else
  409.     Label1.Caption = Label1.Caption & " (Color)"
  410.       End If
  411.   End Select
  412.   'get video driver info
  413.   Label3.Caption = "Video Driver: " & GetSysIni("boot.description", "display.drv")
  414.   Label4.Caption = "Resolution: " & Screen.Width \ Screen.TwipsPerPixelX & " x " & Screen.Height \ Screen.TwipsPerPixelY
  415.   Label5.Caption = "Colors: " & DeviceColors((hDC))
  416. End Sub
  417. Sub Windows_Click ()
  418.   Dim WinFlags As Long, Major As Integer, Minor As Integer, OEM As Integer
  419.   Dim DR As Integer
  420.   Dim temp As String
  421.   Call ClrWin
  422.   Frame1.Caption = "Windows Info..."
  423.   'get Windows info
  424.   WinFlags = GetWinFlags()
  425.   Label1.Caption = "Microsoft Windows Version " & WindowsVersion()
  426.   If WinFlags And WF_ENHANCED Then
  427.     Label1.Caption = Label1.Caption & " (Enhanced Mode)"
  428.   ElseIf WinFlags And WF_STANDARD Then
  429.     Label1.Caption = Label1.Caption & " (Standard Mode)"
  430.   Else
  431.     Label1.Caption = Label1.Caption & " (Real Mode)"
  432.   End If
  433.   'get DOS version
  434.   Call GetDosVer(Major, Minor)
  435.   Label3.Caption = "DOS Version " & Str$(Major) & "." & Str$(Minor)
  436.   'check for DR-DOS
  437.   DR = GetDrDosVer()
  438.   Select Case DR
  439.     Case &H1:
  440.       Label3.Caption = Label3.Caption & " (Multi-User DR-DOS)"
  441.     Case &H60:
  442.       Label3.Caption = Label3.Caption & " (DOS Plus)"
  443.     Case &H63:
  444.       Label3.Caption = Label3.Caption & " (DR-DOS 3.41)"
  445.     Case &H64:
  446.       Label3.Caption = Label3.Caption & " (DR-DOS 3.42)"
  447.     Case &H65:
  448.       Label3.Caption = Label3.Caption & " (DR-DOS 5.0)"
  449.     Case &H67:
  450.       Label3.Caption = Label3.Caption & " (DR-DOS 6.0)"
  451.     Case &H70:
  452.       Label3.Caption = Label3.Caption & " (PalmDOS)"
  453.     Case &H71:
  454.       Label3.Caption = Label3.Caption & " (DR-DOS 6.0 March 1993 Update)"
  455.     Case &H72:
  456.       Label3.Caption = Label3.Caption & " (Novell DOS 7.0)"
  457.   End Select
  458.   'get DOS OEM number and check for PC-DOS 6.1
  459.   OEM = GetDosOem()
  460.   If Major = 6 And Minor = 0 And OEM = 0 Then
  461.     Label3.Caption = Label3.Caption & " (PC-DOS 6.1)"
  462.   End If
  463.   temp = Hex$(OEM)
  464.   If Len(temp) < 2 Then
  465.     temp = "0" & temp & "h"
  466.   Else
  467.     temp = temp & "h"
  468.   End If
  469.   Label4.Caption = "OEM Identification: " & temp
  470.   Select Case OEM
  471.     Case &H0:
  472.       Label4.Caption = Label4.Caption & " (PC-DOS)"
  473.     Case &H1:
  474.       Label4.Caption = Label4.Caption & " (Compaq DOS)"
  475.     Case &H4:
  476.       Label4.Caption = Label4.Caption & " (AT&T DOS)"
  477.     Case &H5:
  478.       Label4.Caption = Label4.Caption & " (Zenith DOS)"
  479.     Case &H6, &H4D:
  480.       Label4.Caption = Label4.Caption & " (Hewlett-Packard DOS)"
  481.     Case &HD:
  482.       Label4.Caption = Label4.Caption & " (Packard-Bell DOS)"
  483.     Case &H16:
  484.       Label4.Caption = Label4.Caption & " (DEC DOS)"
  485.     Case &H23:
  486.       Label4.Caption = Label4.Caption & " (Olivetti DOS)"
  487.     Case &H29:
  488.       Label4.Caption = Label4.Caption & " (Toshiba DOS)"
  489.     Case Else
  490.       Label4.Caption = Label4.Caption & " (MS-DOS)"
  491.   End Select
  492. End Sub
  493.