home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / sgverinf / FRMTEST.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-06-04  |  5.0 KB  |  147 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  3. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
  4. Begin VB.Form frmTest 
  5.    BorderStyle     =   3  'Fixed Dialog
  6.    Caption         =   "Test SG Version Info"
  7.    ClientHeight    =   6315
  8.    ClientLeft      =   2205
  9.    ClientTop       =   2385
  10.    ClientWidth     =   8625
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   6315
  15.    ScaleWidth      =   8625
  16.    ShowInTaskbar   =   0   'False
  17.    Begin MSComDlg.CommonDialog cmnDlg 
  18.       Left            =   5760
  19.       Top             =   1800
  20.       _ExtentX        =   847
  21.       _ExtentY        =   847
  22.       _Version        =   327681
  23.    End
  24.    Begin VB.Frame Frame1 
  25.       Caption         =   "Version Info"
  26.       Height          =   5415
  27.       Left            =   135
  28.       TabIndex        =   3
  29.       Top             =   720
  30.       Width           =   8340
  31.       Begin ComctlLib.ListView lvwVerInfo 
  32.          Height          =   4920
  33.          Left            =   135
  34.          TabIndex        =   4
  35.          Top             =   360
  36.          Width           =   8025
  37.          _ExtentX        =   14155
  38.          _ExtentY        =   8678
  39.          View            =   3
  40.          LabelEdit       =   1
  41.          LabelWrap       =   -1  'True
  42.          HideSelection   =   -1  'True
  43.          _Version        =   327682
  44.          ForeColor       =   -2147483640
  45.          BackColor       =   -2147483643
  46.          BorderStyle     =   1
  47.          Appearance      =   1
  48.          NumItems        =   2
  49.          BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  50.             Key             =   ""
  51.             Object.Tag             =   ""
  52.             Text            =   "Value Name"
  53.             Object.Width           =   2540
  54.          EndProperty
  55.          BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  56.             SubItemIndex    =   1
  57.             Key             =   ""
  58.             Object.Tag             =   ""
  59.             Text            =   "Value"
  60.             Object.Width           =   7937
  61.          EndProperty
  62.       End
  63.    End
  64.    Begin VB.CommandButton cmdBrowse 
  65.       Caption         =   "&Browse..."
  66.       Height          =   375
  67.       Left            =   7155
  68.       TabIndex        =   2
  69.       Top             =   225
  70.       Width           =   1275
  71.    End
  72.    Begin VB.TextBox txtFile 
  73.       Height          =   375
  74.       Left            =   675
  75.       TabIndex        =   0
  76.       Top             =   225
  77.       Width           =   6270
  78.    End
  79.    Begin VB.Label Label1 
  80.       Caption         =   "File:"
  81.       Height          =   330
  82.       Left            =   180
  83.       TabIndex        =   1
  84.       Top             =   270
  85.       Width           =   555
  86.    End
  87. Attribute VB_Name = "frmTest"
  88. Attribute VB_GlobalNameSpace = False
  89. Attribute VB_Creatable = False
  90. Attribute VB_PredeclaredId = True
  91. Attribute VB_Exposed = False
  92. Option Explicit
  93. Dim VerInfo As VersionInfo
  94. Private Sub InsertItem(name$, value$)
  95.     Dim item As ListItem
  96.     Set item = lvwVerInfo.ListItems.Add(, , name)
  97.     item.SubItems(1) = value
  98.         
  99. End Sub
  100. Private Sub ShowVerInfo()
  101.     On Error GoTo Error_
  102.     lvwVerInfo.ListItems.Clear
  103.     Frame1.Caption = "Version Info (" + txtFile.Text + ")"
  104.     VerInfo.Path = txtFile.Text
  105.     If VerInfo.InfoExist Then
  106.         InsertItem "FileDescription", VerInfo.FileDescription
  107.         InsertItem "ProductName", VerInfo.ProductName
  108.         InsertItem "FileVersion", VerInfo.FileVersion
  109.         InsertItem "ProductVersion", VerInfo.ProductVersion
  110.         InsertItem "CompanyName", VerInfo.CompanyName
  111.         InsertItem "InternalName", VerInfo.InternalName
  112.         InsertItem "OriginalFilename", VerInfo.OriginalFilename
  113.         InsertItem "PrivateBuild", VerInfo.PrivateBuild
  114.         InsertItem "SpecialBuild", VerInfo.SpecialBuild
  115.         InsertItem "LegalCopyright", VerInfo.LegalCopyright
  116.         InsertItem "LegalTrademarks", VerInfo.GetValue("StringFileInfo", "LegalTrademarks")
  117.         InsertItem "Language", VerInfo.LanguageName
  118.         InsertItem "Comments", VerInfo.Comments
  119.         InsertItem "OS", VerInfo.FileOSString
  120.     Else
  121.         InsertItem GetFilename(txtFile.Text), "File does not contain version info resource"
  122.     End If
  123.     Exit Sub
  124. Error_:
  125.     MsgBox Error$
  126. End Sub
  127. Private Sub cmdBrowse_Click()
  128.     On Error GoTo Error_
  129.     cmnDlg.Filter = "Win32 Modules (*.exe,*.dll,*.fon,*.ttf)|*.exe;*.dll;*.fon;*.ttf|All Files (*.*)|*.*||"
  130.     cmnDlg.ShowOpen
  131.     If (cmnDlg.filename <> "") Then
  132.         txtFile = cmnDlg.filename
  133.         ShowVerInfo
  134.     End If
  135.     Exit Sub
  136. Error_:
  137.     MsgBox Error$
  138. End Sub
  139. Private Sub Form_Load()
  140.     Set VerInfo = New VersionInfo
  141. End Sub
  142. Private Sub txtFile_KeyDown(KeyCode As Integer, Shift As Integer)
  143.     If (KeyCode = vbKeyReturn) Then
  144.         ShowVerInfo
  145.     End If
  146. End Sub
  147.