home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / CODIGO_1 / AT_SPY / MAIN.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-06-16  |  3.8 KB  |  120 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "VB App.Title Spy"
  6.    ClientHeight    =   1215
  7.    ClientLeft      =   1095
  8.    ClientTop       =   1635
  9.    ClientWidth     =   4935
  10.    Height          =   1620
  11.    Icon            =   MAIN.FRX:0000
  12.    Left            =   1035
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   1215
  17.    ScaleWidth      =   4935
  18.    Top             =   1290
  19.    Width           =   5055
  20.    Begin CommandButton cmdAppTitle 
  21.       BackColor       =   &H00C0C0C0&
  22.       Caption         =   "&Get App.Title"
  23.       Default         =   -1  'True
  24.       Enabled         =   0   'False
  25.       Height          =   375
  26.       Left            =   1200
  27.       TabIndex        =   3
  28.       Top             =   720
  29.       Width           =   2055
  30.    End
  31.    Begin CommandButton cmdBrowse 
  32.       BackColor       =   &H00C0C0C0&
  33.       Caption         =   "&Browse..."
  34.       Height          =   375
  35.       Left            =   3360
  36.       TabIndex        =   4
  37.       Top             =   720
  38.       Width           =   1335
  39.    End
  40.    Begin CommonDialog cmdOpen 
  41.       CancelError     =   -1  'True
  42.       DefaultExt      =   "*.exe"
  43.       DialogTitle     =   "Browse"
  44.       Filter          =   "Executables (*.EXE)"
  45.       Flags           =   4100
  46.       Left            =   2040
  47.       Top             =   1680
  48.    End
  49.    Begin SSPanel Panel3D1 
  50.       AutoSize        =   3  'AutoSize Child To Panel
  51.       BevelOuter      =   1  'Inset
  52.       Height          =   330
  53.       Left            =   1200
  54.       TabIndex        =   1
  55.       Top             =   240
  56.       Width           =   3495
  57.       Begin TextBox txtFilename 
  58.          Height          =   300
  59.          Left            =   15
  60.          TabIndex        =   2
  61.          Top             =   15
  62.          Width           =   3465
  63.       End
  64.    End
  65.    Begin Label Label1 
  66.       AutoSize        =   -1  'True
  67.       BackColor       =   &H00C0C0C0&
  68.       Caption         =   "&Filename:"
  69.       Height          =   195
  70.       Left            =   240
  71.       TabIndex        =   0
  72.       Top             =   240
  73.       Width           =   825
  74.    End
  75. Sub cmdAppTitle_Click ()
  76.     Dim sErrMsg As String
  77.     Dim sAppTitle As String
  78.     On Error Resume Next
  79.     ' Get the App.Title of the given file.
  80.     sAppTitle = GetAppTitle(txtFileName)
  81.     ' If there was no error then display the title retrieved.
  82.     If Err = 0 Then
  83.         MsgBox "App.Title of " & txtFileName & " is:" & Chr$(13) & Chr$(10) & sAppTitle, MB_ICONINFORMATION
  84.     Else
  85.         ' Was it a Visual Basic trappable error?
  86.         If Err < GATERR_FIRST Or Err > GATERR_LAST Then
  87.             
  88.             sErrMsg = Error$
  89.         Else
  90.             
  91.             ' Determine the error string using the
  92.             ' custom error code returned by GetAppTitle().
  93.             Select Case Err
  94.                 Case GATERR_NOTDOSEXE: sErrMsg = "DOS"
  95.                 Case GATERR_NOTWINEXE: sErrMsg = "Windows"
  96.                 Case GATERR_NOTVBEXE: sErrMsg = "Visual Basic application"
  97.             End Select
  98.             sErrMsg = "This file is not a " & sErrMsg & " executable."
  99.         End If
  100.         ' Display the error message.
  101.         MsgBox sErrMsg, MB_ICONEXCLAMATION
  102.     End If
  103. End Sub
  104. Sub cmdBrowse_Click ()
  105.     On Error Resume Next
  106.     cmdOpen.Filename = "*.exe"
  107.     cmdOpen.Action = DLG_FILE_OPEN
  108.     If Err = 0 Then
  109.         txtFileName = cmdOpen.Filename
  110.     End If
  111. End Sub
  112. Sub Form_Load ()
  113.     ' Center the form.
  114.     Me.Left = (Screen.Width - Me.Width) / 2
  115.     Me.Top = (Screen.Height - Me.Height) / 2
  116. End Sub
  117. Sub txtFilename_Change ()
  118.     cmdAppTitle.Enabled = Len(txtFileName) <> 0
  119. End Sub
  120.