home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / FERRAMEN / VB_ASM / SNOOPER.ZIP / SNOOPER.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-06-19  |  5.9 KB  |  168 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Snooper"
  5.    ClientHeight    =   2175
  6.    ClientLeft      =   1095
  7.    ClientTop       =   1785
  8.    ClientWidth     =   4215
  9.    Height          =   2865
  10.    Icon            =   SNOOPER.FRX:0000
  11.    Left            =   1035
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   2175
  14.    ScaleWidth      =   4215
  15.    Top             =   1155
  16.    Width           =   4335
  17.    Begin ComboBox cboCategory 
  18.       Height          =   300
  19.       Left            =   1200
  20.       Style           =   2  'Dropdown List
  21.       TabIndex        =   1
  22.       Top             =   120
  23.       Width           =   2895
  24.    End
  25.    Begin TextBox txtDetails 
  26.       Height          =   1575
  27.       Left            =   120
  28.       MultiLine       =   -1  'True
  29.       ScrollBars      =   2  'Vertical
  30.       TabIndex        =   2
  31.       Top             =   480
  32.       Width           =   3975
  33.    End
  34.    Begin Label Label1 
  35.       BackColor       =   &H00C0C0C0&
  36.       Caption         =   "&Category:"
  37.       Height          =   255
  38.       Left            =   120
  39.       TabIndex        =   0
  40.       Top             =   120
  41.       Width           =   975
  42.    End
  43.    Begin Menu mnuFile 
  44.       Caption         =   "&File"
  45.       Begin Menu mnuFileAbout 
  46.          Caption         =   "&About..."
  47.          Shortcut        =   ^A
  48.       End
  49.       Begin Menu mnuFileSep01 
  50.          Caption         =   "-"
  51.       End
  52.       Begin Menu mnuFileExit 
  53.          Caption         =   "E&xit"
  54.       End
  55.    End
  56.    Begin Menu mnuWinSpy 
  57.       Caption         =   "&Window Spy!"
  58.    End
  59. Option Explicit
  60. 'Keep track of current category to avoid needless updates
  61. Dim currentCategory As Integer
  62. Sub cboCategory_Click ()
  63.     'Update category details if category has changed
  64.     If cboCategory.ListIndex <> currentCategory Then
  65.         'Display hourglass cursor during processing
  66.         Screen.MousePointer = 11
  67.         'Update category
  68.         currentCategory = cboCategory.ListIndex
  69.         'Dispatch correct procedure
  70.         Select Case currentCategory
  71.             Case CATEGORY_DOSINFO
  72.                 Call ShowDOSInfo
  73.             Case CATEGORY_WINDOWSINFO
  74.                 Call ShowWindowsInfo
  75.             Case CATEGORY_HARDWAREINFO
  76.                 Call ShowHardwareInfo
  77.             Case CATEGORY_DISPLAYINFO
  78.                 Call ShowDisplayInfo
  79.             Case CATEGORY_PRINTERINFO
  80.                 Call ShowPrinterInfo
  81.             Case CATEGORY_DRIVESINFO
  82.                 Call ShowDrivesInfo
  83.             Case CATEGORY_INTVECTORS
  84.                 Call ShowIntVectors
  85.             Case CATEGORY_AUTOEXECBAT
  86.                 Call ShowAutoExecBat
  87.             Case CATEGORY_CONFIGSYS
  88.                 Call ShowConfigSys
  89.             Case CATEGORY_WININI
  90.                 Call ShowWinIni
  91.         End Select
  92.         'Restore mouse cursor
  93.         Screen.MousePointer = 0
  94.     End If
  95. End Sub
  96. Sub Form_Load ()
  97.     Dim i As Long
  98.     currentCategory = -1
  99.     newLine = Chr$(13) & Chr$(10)
  100.     'Populate combo box with available categories
  101.     cboCategory.AddItem "Windows Information"
  102.     cboCategory.AddItem "DOS Information"
  103.     cboCategory.AddItem "Hardware Information"
  104.     cboCategory.AddItem "Display Information"
  105.     cboCategory.AddItem "Printer Information"
  106.     cboCategory.AddItem "Drives Information"
  107.     cboCategory.AddItem "Interrupt Vectors"
  108.     cboCategory.AddItem "View AUTOEXEC.BAT"
  109.     cboCategory.AddItem "View CONFIG.SYS"
  110.     cboCategory.AddItem "View WIN.INI"
  111.     cboCategory.ListIndex = 0
  112.     'Prevent user from editing text box
  113.     i = SendMessage(txtDetails.hWnd, EM_SETREADONLY, True, 0&)
  114.     'Center category combo box between area above text box
  115.     cboCategory.Top = (txtDetails.Top - cboCategory.Height) / 2
  116.     'Size form to screen and center
  117.     Width = Screen.Width * .75
  118.     Height = Screen.Height * .75
  119.     Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
  120. End Sub
  121. Sub Form_Paint ()
  122.     Dim x As Long, y As Long
  123.     'Since some programmers may not have the 3D panel
  124.     'control, we'll just draw our own 3D shading
  125.     x = Screen.TwipsPerPixelX: y = Screen.TwipsPerPixelY
  126.     'Clear any previously-drawn lines
  127.     Line (0, 0)-(ScaleWidth, ScaleHeight), backcolor, BF
  128.     'And make the combo box look "sunken"
  129.     CurrentX = cboCategory.Left - x
  130.     CurrentY = cboCategory.Top + cboCategory.Height
  131.     Line -Step(0, -(cboCategory.Height + y)), RGB(92, 92, 92)
  132.     Line -Step(cboCategory.Width + x, 0), RGB(92, 92, 92)
  133.     Line -Step(0, cboCategory.Height + y), RGB(255, 255, 255)
  134.     Line -Step(-(cboCategory.Width + x), 0), RGB(255, 255, 255)
  135.     'Same for text box
  136.     CurrentX = txtDetails.Left - x
  137.     CurrentY = txtDetails.Top + txtDetails.Height
  138.     Line -Step(0, -(txtDetails.Height + y)), RGB(92, 92, 92)
  139.     Line -Step(txtDetails.Width + x, 0), RGB(92, 92, 92)
  140.     Line -Step(0, txtDetails.Height + y), RGB(255, 255, 255)
  141.     Line -Step(-(txtDetails.Width + x), 0), RGB(255, 255, 255)
  142. End Sub
  143. Sub Form_Resize ()
  144.     Dim sizeX As Integer, sizeY As Integer
  145.     'Rearrange controls if window not minimized
  146.     If WindowState <> 1 Then
  147.         'Determine smallest area to size controls
  148.         sizeX = cboCategory.Left + 240
  149.         sizeY = txtDetails.Top + 240
  150.         'Resize to larger area if there's room
  151.         If ScaleWidth > sizeX Then sizeX = ScaleWidth
  152.         If ScaleHeight > sizeY Then sizeY = ScaleHeight
  153.         'Size controls to fit window
  154.         cboCategory.Move cboCategory.Left, cboCategory.Top, sizeX - (cboCategory.Left + 120)
  155.         txtDetails.Move txtDetails.Left, txtDetails.Top, sizeX - (txtDetails.Left + 120), sizeY - (txtDetails.Top + 120)
  156.     End If
  157. End Sub
  158. Sub mnuFileAbout_Click ()
  159.     'Display about form
  160.     frmAbout.Show 1
  161. End Sub
  162. Sub mnuFileExit_Click ()
  163.     Unload Me
  164. End Sub
  165. Sub mnuWinSpy_Click ()
  166.     frmWinInfo.Show 1
  167. End Sub
  168.