vbAccelerator - Contents of code file: frmTypeLib.frmVERSION 5.00
Begin VB.Form frmTypeLib
Caption = "Type Library Registration"
ClientHeight = 4275
ClientLeft = 5145
ClientTop = 2910
ClientWidth = 4905
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmTypeLib.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4275
ScaleWidth = 4905
Begin VB.TextBox txtInfo
BackColor = &H8000000F&
Height = 315
Index = 3
Left = 120
Locked = -1 'True
TabIndex = 11
Top = 3060
Width = 4695
End
Begin VB.CommandButton cmdUnregister
Caption = "&Unregister"
Height = 435
Left = 3600
TabIndex = 10
Top = 3720
Width = 1275
End
Begin VB.CommandButton cmdRegister
Caption = "&Register"
Height = 435
Left = 2220
TabIndex = 9
Top = 3720
Width = 1275
End
Begin VB.TextBox txtInfo
BackColor = &H8000000F&
Height = 315
Index = 2
Left = 120
Locked = -1 'True
TabIndex = 7
Top = 2400
Width = 4695
End
Begin VB.TextBox txtInfo
BackColor = &H8000000F&
Height = 315
Index = 1
Left = 120
Locked = -1 'True
TabIndex = 5
Top = 1740
Width = 4695
End
Begin VB.TextBox txtInfo
BackColor = &H8000000F&
Height = 315
Index = 0
Left = 120
Locked = -1 'True
TabIndex = 3
Top = 1140
Width = 4695
End
Begin VB.CommandButton cmdBrowse
Caption = "..."
Height = 315
Left = 4500
TabIndex = 2
ToolTipText = "Browse for File"
Top = 360
Width = 315
End
Begin VB.TextBox txtLib
Height = 315
Left = 60
TabIndex = 1
Top = 300
Width = 4755
End
Begin VB.Label lblInfo
Caption = "Registered:"
Height = 255
Index = 3
Left = 120
TabIndex = 12
Top = 2820
Width = 1095
End
Begin VB.Label lblInfo
Caption = "Version:"
Height = 255
Index = 2
Left = 120
TabIndex = 8
Top = 2160
Width = 1095
End
Begin VB.Label lblInfo
Caption = "GUID:"
Height = 255
Index = 1
Left = 120
TabIndex = 6
Top = 1500
Width = 495
End
Begin VB.Label lblInfo
Caption = "Name:"
Height = 255
Index = 0
Left = 120
TabIndex = 4
Top = 900
Width = 495
End
Begin VB.Label lblCaption
Caption = "Type Library:"
Height = 255
Left = 60
TabIndex = 0
Top = 60
Width = 3855
End
Begin VB.Menu mnuFileTOP
Caption = "&File"
Begin VB.Menu mnuFile
Caption = "&Open..."
Index = 0
Shortcut = ^O
End
Begin VB.Menu mnuFile
Caption = "-"
Index = 1
End
Begin VB.Menu mnuFile
Caption = "&Register Type Lib..."
Index = 2
Shortcut = {F5}
End
Begin VB.Menu mnuFile
Caption = "&Unregister Type Lib..."
Index = 3
End
Begin VB.Menu mnuFile
Caption = "-"
Index = 4
End
Begin VB.Menu mnuFile
Caption = "E&xit"
Index = 5
End
End
Begin VB.Menu mnuViewTOP
Caption = "&View"
Begin VB.Menu mnuView
Caption = "&Type Libs in Registry..."
Index = 0
End
End
Begin VB.Menu mnuHelpTOP
Caption = "&Help"
Begin VB.Menu mnuHelp
Caption = "&vbAccelerator RegTLB Help..."
Index = 0
Shortcut = {F1}
End
Begin VB.Menu mnuHelp
Caption = "vbAccelerator on the &Web..."
Index = 1
End
Begin VB.Menu mnuHelp
Caption = "-"
Index = 2
End
Begin VB.Menu mnuHelp
Caption = "&About..."
Index = 3
End
End
End
Attribute VB_Name = "frmTypeLib"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Sub ShowTLBInfo(ByVal sFile As String)
On Error GoTo ErrorHandler
If sFile = "" Then
txtInfo(0).Text = ""
txtInfo(1).Text = ""
txtInfo(2).Text = ""
txtInfo(3).Text = ""
Else
Dim sName As String, sSection As String
Dim cTLI As TypeLibInfo
Set cTLI = TLI.TypeLibInfoFromFile(sFile)
With cTLI
txtInfo(0).Text = .Name & " (" & .HelpString & ")"
txtInfo(1).Text = .GUID
txtInfo(2).Text = .MajorVersion & "." & .MinorVersion
sSection = "TypeLib\" & txtInfo(1).Text & "\" &
LCase$(Hex$(.MajorVersion)) & "." & LCase$(Hex$(.MinorVersion))
sName = .HelpString
End With
Dim cR As New cRegistry
cR.ClassKey = HKEY_CLASSES_ROOT
cR.SectionKey = sSection
cR.ValueType = REG_SZ
If cR.Value = sName Then
txtInfo(3).Text = "Yes"
Else
txtInfo(3).Text = "No"
End If
End If
Exit Sub
ErrorHandler:
txtInfo(0).Text = ""
txtInfo(1).Text = ""
txtInfo(2).Text = ""
'chkRegistered.Value = Unchecked
'chkRegistered.Enabled = False
'chkRegistered.Tag = ""
Exit Sub
End Sub
Public Property Let Filename(ByVal sFile As String)
txtLib.Text = sFile
End Property
Public Sub Register(ByVal bState As Boolean)
If (UIRegisterTypeLib(txtLib.Text, bState, True)) Then
Unload Me
End If
End Sub
Private Sub cmdBrowse_Click()
mnuFile_Click 0
End Sub
Private Sub cmdRegister_Click()
mnuFile_Click 2
End Sub
Private Sub cmdUnregister_Click()
mnuFile_Click 3
End Sub
Private Sub Form_Load()
Me.Move (Screen.width - Me.width) \ 2, (Screen.Height - Me.Height) \ 2
RightMargin(txtLib) = cmdBrowse.width \ Screen.TwipsPerPixelY
End Sub
Private Sub Form_Paint()
SizeGrip Me.hdc, Me.ScaleWidth \ Screen.TwipsPerPixelY, Me.ScaleHeight \
Screen.TwipsPerPixelY
HorizontalSeparator Me.hdc, 0, 0, Me.ScaleWidth \ Screen.TwipsPerPixelY
End Sub
Private Sub Form_Resize()
Dim i As Long
On Error Resume Next
txtLib.Move txtLib.left, txtLib.top, Me.ScaleWidth - txtLib.left * 2
For i = 0 To 2
txtInfo(i).Move txtLib.left, txtInfo(i).top, txtLib.width
Next i
cmdBrowse.Move txtLib.left + txtLib.width - cmdBrowse.width - 2 *
Screen.TwipsPerPixelX, txtLib.top + 2 * Screen.TwipsPerPixelY,
cmdBrowse.width, txtLib.Height - 4 * Screen.TwipsPerPixelY
End Sub
Private Sub mnuFile_Click(Index As Integer)
Select Case Index
Case 0
Dim sFile As String
If VBGetOpenFileName(sFile, , , , , , "Type Libraries
(*.TLB;*.OLB;*.DLL)|*.TLB;*.OLB;*.DLL|Type Library Files
(*.TLB)|*.TLB|Object Library Files (*.OLB)|*.OLB|DLL Files
(*.DLL)|*.DLL|All Files (*.*)|*.*", 1, , "Choose Type Library to
Register", "TLB", Me.hWnd) Then
txtLib.Text = sFile
ShowTLBInfo sFile
End If
Case 2
sFile = txtLib.Text
If FileExists(sFile) Then
UIRegisterTypeLib sFile, True, True
ShowTLBInfo sFile
Else
ShowTLBInfo ""
MsgBox "Could not find the file '" & txtLib.Text & "'." & vbCrLf &
vbCrLf & "Please check your typing and try again.", vbCritical
txtLib.SetFocus
End If
Case 3
sFile = txtLib.Text
If FileExists(sFile) Then
UIRegisterTypeLib sFile, False, True
ShowTLBInfo sFile
Else
ShowTLBInfo ""
MsgBox "Could not find the file '" & txtLib.Text & "'." & vbCrLf &
vbCrLf & "Please check your typing and try again.", vbCritical
txtLib.SetFocus
End If
Case 5
Unload Me
End Select
End Sub
Private Sub mnuHelp_Click(Index As Integer)
Dim sExe As String
Select Case Index
Case 0
sExe = App.Path
NormalizePath sExe
sExe = sExe & App.EXEName & ".exe"
ShellEx "res://" & sExe & "/index.htm"
Case 1
ShellEx "http://vbaccelerator.com/"
Case 3
frmAbout.Show vbModal, Me
End Select
End Sub
Private Sub mnuView_Click(Index As Integer)
Select Case Index
Case 0
Dim fMTL As New frmManageTypeLib
fMTL.ParentForm = Me
fMTL.Show vbModal, Me
End Select
End Sub
|
|