?? form1.frm
字號(hào):
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmMain
Caption = "注冊(cè)/反注冊(cè) OCX DLL TLB"
ClientHeight = 3360
ClientLeft = 2205
ClientTop = 3255
ClientWidth = 7650
ClipControls = 0 'False
Icon = "Form1.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3360
ScaleWidth = 7650
Begin VB.CommandButton Command1
Caption = "注冊(cè)本目錄"
Height = 375
Left = 6280
TabIndex = 5
Top = 50
Width = 1215
End
Begin MSComDlg.CommonDialog cdl
Left = 5520
Top = 1800
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.ListBox List1
Height = 2400
Left = 120
TabIndex = 4
Top = 840
Width = 7335
End
Begin VB.OptionButton op
Caption = "反注冊(cè)(&U)"
Height = 180
Index = 1
Left = 2520
TabIndex = 3
Top = 120
Width = 1215
End
Begin VB.OptionButton op
Caption = "注冊(cè)(&R)"
Height = 180
Index = 0
Left = 600
TabIndex = 2
Top = 120
Value = -1 'True
Width = 1095
End
Begin VB.TextBox txtPath
Height = 270
Left = 120
TabIndex = 1
Top = 480
Width = 6855
End
Begin VB.CommandButton cmdFile
Caption = "..."
BeginProperty Font
Name = "System"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 7080
TabIndex = 0
Top = 420
Width = 435
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'
' Brad Martinez, http://www.mvps.org
'
' Demonstrates how to register and unregister type libraries in VB code
'
Private Sub Command1_Click()
Dim sDir As String
sDir = Dir(App.Path & "\*.*")
'sDir = Dir("F:\Public\", vbDirectory)
Do While sDir <> ""
sDir = App.Path & "\" & sDir
'sDir = "F:\Public\" & sDir
DoEvents
txtPath.Text = sDir
If op(0).Value Then
If LCase(Right(sDir, 3)) = "ocx" Or LCase(Right(sDir, 3)) = "dll" Then
If RegServer(sDir) Then
List1.AddItem sDir & " 注冊(cè)成功!"
Else
List1.AddItem sDir & " 注冊(cè)失敗!"
End If
ElseIf LCase(Right(sDir, 3)) = "tlb" Then
If RegTypelib(sDir) Then
List1.AddItem sDir & " 注冊(cè)成功!"
Else
List1.AddItem sDir & " 注冊(cè)失敗!"
End If
End If
Else
If LCase(Right(sDir, 3)) = "ocx" Or LCase(Right(sDir, 3)) = "dll" Then
If UnRegServer(sDir) Then
List1.AddItem sDir & " 反注冊(cè)成功!"
Else
List1.AddItem sDir & " 反注冊(cè)失敗!"
End If
ElseIf LCase(Right(sDir, 3)) = "tlb" Then
If UnregTypelib(sDir) Then
List1.AddItem sDir & " 反注冊(cè)成功!"
Else
List1.AddItem sDir & " 反注冊(cè)失敗!"
End If
End If
End If
sDir = Dir
Debug.Print sDir
Loop
List1.AddItem "注冊(cè)完畢"
End Sub
Private Sub Form_Load()
'cmdRegister.Enabled = False
'cmdUnregister.Enabled = False
End Sub
Private Sub cmdFile_Click()
With cdl
' 設(shè)置過(guò)濾條件。
.Filter = "所有文件 (*.*)|*.*|DLL 文件;OCX 文件;TLB文件|*.dll;*.ocx;*.tlb"
' 指定缺省的過(guò)濾條件索引。
.FilterIndex = 2
' 此“打開(kāi)”對(duì)話框具有類似于資源管理器的對(duì)話框模板,
' 支持長(zhǎng)文件名和多重選擇,并顯示“幫助”按鈕。
.Flags = cdlOFNExplorer Or _
cdlOFNLongNames Or _
cdlOFNAllowMultiselect Or _
cdlOFNHelpButton
' 顯示“打開(kāi)”對(duì)話框。
.ShowOpen
If .FileName = "" Then Exit Sub
Dim strPath As String
Dim strFileName() As String
' 調(diào)用GetMultiFiles方法,以獲得文件的路徑和文件名。
Call GetMultiFiles(.FileName, strPath, strFileName())
' 清除列表框。
List1.Clear
' 將通用對(duì)話框返回的文件字符串加入到列表框中。
'List1.AddItem .FileName
' 在列表框中插入一空行。
'List1.AddItem ""
End With
Dim i As Integer
' 通過(guò)下列循環(huán)將文件名及其全路徑加入到列表框中。
For i = LBound(strFileName) To UBound(strFileName)
DoEvents
txtPath.Text = strPath & "\" & strFileName(i)
If op(0).Value Then
If LCase(Right(strPath & "\" & strFileName(i), 3)) = "ocx" Or LCase(Right(strPath & "\" & strFileName(i), 3)) = "dll" Then
If RegServer(strPath & "\" & strFileName(i)) Then
List1.AddItem strPath & "\" & strFileName(i) & " 注冊(cè)成功!"
Else
List1.AddItem strPath & "\" & strFileName(i) & " 注冊(cè)失敗!"
End If
ElseIf LCase(Right(strPath & "\" & strFileName(i), 3)) = "tlb" Then
If RegTypelib(strPath & "\" & strFileName(i)) Then
List1.AddItem strPath & "\" & strFileName(i) & " 注冊(cè)成功!"
Else
List1.AddItem strPath & "\" & strFileName(i) & " 注冊(cè)失敗!"
End If
End If
Else
If LCase(Right(strPath & "\" & strFileName(i), 3)) = "ocx" Or LCase(Right(strPath & "\" & strFileName(i), 3)) = "dll" Then
If UnRegServer(strPath & "\" & strFileName(i)) Then
List1.AddItem strPath & "\" & strFileName(i) & " 反注冊(cè)成功!"
Else
List1.AddItem strPath & "\" & strFileName(i) & " 反注冊(cè)失敗!"
End If
ElseIf LCase(Right(strPath & "\" & strFileName(i), 3)) = "tlb" Then
If UnregTypelib(strPath & "\" & strFileName(i)) Then
List1.AddItem strPath & "\" & strFileName(i) & " 反注冊(cè)成功!"
Else
List1.AddItem strPath & "\" & strFileName(i) & " 反注冊(cè)失敗!"
End If
End If
End If
Next i
List1.AddItem "注冊(cè)完畢"
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -