home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmMain
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "VB App.Title Spy"
- ClientHeight = 1215
- ClientLeft = 1095
- ClientTop = 1635
- ClientWidth = 4935
- Height = 1620
- Icon = MAIN.FRX:0000
- Left = 1035
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1215
- ScaleWidth = 4935
- Top = 1290
- Width = 5055
- Begin CommandButton cmdAppTitle
- BackColor = &H00C0C0C0&
- Caption = "&Get App.Title"
- Default = -1 'True
- Enabled = 0 'False
- Height = 375
- Left = 1200
- TabIndex = 3
- Top = 720
- Width = 2055
- End
- Begin CommandButton cmdBrowse
- BackColor = &H00C0C0C0&
- Caption = "&Browse..."
- Height = 375
- Left = 3360
- TabIndex = 4
- Top = 720
- Width = 1335
- End
- Begin CommonDialog cmdOpen
- CancelError = -1 'True
- DefaultExt = "*.exe"
- DialogTitle = "Browse"
- Filter = "Executables (*.EXE)"
- Flags = 4100
- Left = 2040
- Top = 1680
- End
- Begin SSPanel Panel3D1
- AutoSize = 3 'AutoSize Child To Panel
- BevelOuter = 1 'Inset
- Height = 330
- Left = 1200
- TabIndex = 1
- Top = 240
- Width = 3495
- Begin TextBox txtFilename
- Height = 300
- Left = 15
- TabIndex = 2
- Top = 15
- Width = 3465
- End
- End
- Begin Label Label1
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- Caption = "&Filename:"
- Height = 195
- Left = 240
- TabIndex = 0
- Top = 240
- Width = 825
- End
- Sub cmdAppTitle_Click ()
- Dim sErrMsg As String
- Dim sAppTitle As String
- On Error Resume Next
- ' Get the App.Title of the given file.
- sAppTitle = GetAppTitle(txtFileName)
- ' If there was no error then display the title retrieved.
- If Err = 0 Then
- MsgBox "App.Title of " & txtFileName & " is:" & Chr$(13) & Chr$(10) & sAppTitle, MB_ICONINFORMATION
- Else
- ' Was it a Visual Basic trappable error?
- If Err < GATERR_FIRST Or Err > GATERR_LAST Then
-
- sErrMsg = Error$
- Else
-
- ' Determine the error string using the
- ' custom error code returned by GetAppTitle().
- Select Case Err
- Case GATERR_NOTDOSEXE: sErrMsg = "DOS"
- Case GATERR_NOTWINEXE: sErrMsg = "Windows"
- Case GATERR_NOTVBEXE: sErrMsg = "Visual Basic application"
- End Select
- sErrMsg = "This file is not a " & sErrMsg & " executable."
- End If
- ' Display the error message.
- MsgBox sErrMsg, MB_ICONEXCLAMATION
- End If
- End Sub
- Sub cmdBrowse_Click ()
- On Error Resume Next
- cmdOpen.Filename = "*.exe"
- cmdOpen.Action = DLG_FILE_OPEN
- If Err = 0 Then
- txtFileName = cmdOpen.Filename
- End If
- End Sub
- Sub Form_Load ()
- ' Center the form.
- Me.Left = (Screen.Width - Me.Width) / 2
- Me.Top = (Screen.Height - Me.Height) / 2
- End Sub
- Sub txtFilename_Change ()
- cmdAppTitle.Enabled = Len(txtFileName) <> 0
- End Sub
-