home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / tool / various / vbasm / snooper.frm < prev    next >
Text File  |  1994-06-18  |  6KB  |  193 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. End
  60. Option Explicit
  61.  
  62. 'Keep track of current category to avoid needless updates
  63. Dim currentCategory As Integer
  64.  
  65. Sub cboCategory_Click ()
  66.  
  67.     'Update category details if category has changed
  68.     If cboCategory.ListIndex <> currentCategory Then
  69.         'Display hourglass cursor during processing
  70.         Screen.MousePointer = 11
  71.         'Update category
  72.         currentCategory = cboCategory.ListIndex
  73.         'Dispatch correct procedure
  74.         Select Case currentCategory
  75.             Case CATEGORY_DOSINFO
  76.                 Call ShowDOSInfo
  77.             Case CATEGORY_WINDOWSINFO
  78.                 Call ShowWindowsInfo
  79.             Case CATEGORY_HARDWAREINFO
  80.                 Call ShowHardwareInfo
  81.             Case CATEGORY_DISPLAYINFO
  82.                 Call ShowDisplayInfo
  83.             Case CATEGORY_PRINTERINFO
  84.                 Call ShowPrinterInfo
  85.             Case CATEGORY_DRIVESINFO
  86.                 Call ShowDrivesInfo
  87.             Case CATEGORY_INTVECTORS
  88.                 Call ShowIntVectors
  89.             Case CATEGORY_AUTOEXECBAT
  90.                 Call ShowAutoExecBat
  91.             Case CATEGORY_CONFIGSYS
  92.                 Call ShowConfigSys
  93.             Case CATEGORY_WININI
  94.                 Call ShowWinIni
  95.         End Select
  96.         'Restore mouse cursor
  97.         Screen.MousePointer = 0
  98.     End If
  99.  
  100. End Sub
  101.  
  102. Sub Form_Load ()
  103.     Dim i As Long
  104.  
  105.     currentCategory = -1
  106.     newLine = Chr$(13) & Chr$(10)
  107.  
  108.     'Populate combo box with available categories
  109.     cboCategory.AddItem "Windows Information"
  110.     cboCategory.AddItem "DOS Information"
  111.     cboCategory.AddItem "Hardware Information"
  112.     cboCategory.AddItem "Display Information"
  113.     cboCategory.AddItem "Printer Information"
  114.     cboCategory.AddItem "Drives Information"
  115.     cboCategory.AddItem "Interrupt Vectors"
  116.     cboCategory.AddItem "View AUTOEXEC.BAT"
  117.     cboCategory.AddItem "View CONFIG.SYS"
  118.     cboCategory.AddItem "View WIN.INI"
  119.     cboCategory.ListIndex = 0
  120.  
  121.     'Prevent user from editing text box
  122.     i = SendMessage(txtDetails.hWnd, EM_SETREADONLY, True, 0&)
  123.  
  124.     'Center category combo box between area above text box
  125.     cboCategory.Top = (txtDetails.Top - cboCategory.Height) / 2
  126.     
  127.     'Size form to screen and center
  128.     Width = Screen.Width * .75
  129.     Height = Screen.Height * .75
  130.     Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
  131.  
  132. End Sub
  133.  
  134. Sub Form_Paint ()
  135.     Dim x As Long, y As Long
  136.  
  137.     'Since some programmers may not have the 3D panel
  138.     'control, we'll just draw our own 3D shading
  139.     x = Screen.TwipsPerPixelX: y = Screen.TwipsPerPixelY
  140.  
  141.     'Clear any previously-drawn lines
  142.     Line (0, 0)-(ScaleWidth, ScaleHeight), backcolor, BF
  143.  
  144.     'And make the combo box look "sunken"
  145.     CurrentX = cboCategory.Left - x
  146.     CurrentY = cboCategory.Top + cboCategory.Height
  147.     Line -Step(0, -(cboCategory.Height + y)), RGB(92, 92, 92)
  148.     Line -Step(cboCategory.Width + x, 0), RGB(92, 92, 92)
  149.     Line -Step(0, cboCategory.Height + y), RGB(255, 255, 255)
  150.     Line -Step(-(cboCategory.Width + x), 0), RGB(255, 255, 255)
  151.     
  152.     'Same for text box
  153.     CurrentX = txtDetails.Left - x
  154.     CurrentY = txtDetails.Top + txtDetails.Height
  155.     Line -Step(0, -(txtDetails.Height + y)), RGB(92, 92, 92)
  156.     Line -Step(txtDetails.Width + x, 0), RGB(92, 92, 92)
  157.     Line -Step(0, txtDetails.Height + y), RGB(255, 255, 255)
  158.     Line -Step(-(txtDetails.Width + x), 0), RGB(255, 255, 255)
  159.  
  160. End Sub
  161.  
  162. Sub Form_Resize ()
  163.     Dim sizeX As Integer, sizeY As Integer
  164.  
  165.     'Rearrange controls if window not minimized
  166.     If WindowState <> 1 Then
  167.         'Determine smallest area to size controls
  168.         sizeX = cboCategory.Left + 240
  169.         sizeY = txtDetails.Top + 240
  170.         'Resize to larger area if there's room
  171.         If ScaleWidth > sizeX Then sizeX = ScaleWidth
  172.         If ScaleHeight > sizeY Then sizeY = ScaleHeight
  173.         'Size controls to fit window
  174.         cboCategory.Move cboCategory.Left, cboCategory.Top, sizeX - (cboCategory.Left + 120)
  175.         txtDetails.Move txtDetails.Left, txtDetails.Top, sizeX - (txtDetails.Left + 120), sizeY - (txtDetails.Top + 120)
  176.     End If
  177.  
  178. End Sub
  179.  
  180. Sub mnuFileAbout_Click ()
  181.     'Display about form
  182.     frmAbout.Show 1
  183. End Sub
  184.  
  185. Sub mnuFileExit_Click ()
  186.     Unload Me
  187. End Sub
  188.  
  189. Sub mnuWinSpy_Click ()
  190.     frmWinInfo.Show 1
  191. End Sub
  192.  
  193.