📄 shift.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 1710
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 1710
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "恢复TXT文件的打开方式"
Height = 735
Left = 600
TabIndex = 1
Top = 840
Width = 3375
End
Begin VB.CommandButton Command1
Caption = "修改注册表改变TXT文件的打开方式"
Height = 615
Left = 600
TabIndex = 0
Top = 120
Width = 3375
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim RegEdit As Object, Apppath As String
Apppath = IIf(Right(App.Path, 1) = "\", Left(App.Path, Len(App.Path) - 1), App.Path)
'取得当前路径,如果是在根目录下就要去掉一个“\"
Set RegEdit = CreateObject("WScript.Shell")
RegEdit.regwrite "HKEY_CLASSES_ROOT\txtfile\shell\open\command\", Apppath & "\" & App.EXEName & ".exe %1"
MsgBox "已将本程序关联到txt类型文件!请打开同一文件夹内的test.txt,测试一下。"
End Sub
Private Sub Command2_Click()
Dim RegEdit As Object
Set RegEdit = CreateObject("WScript.Shell")
RegEdit.regwrite "HKEY_CLASSES_ROOT\txtfile\shell\open\command\", "NOTEPAD.EXE %1"
MsgBox "已修复txt类型文件的关联!请打开同一文件夹内的test.txt,测试一下。"
End Sub
Private Sub Form_Load()
On Error Resume Next
Dim cmd As String
cmd = Command()
If cmd <> "" Then
MsgBox "系统传给程序的参数是:" & Chr(13) & cmd
Shell "NOTEPAD.EXE " & cmd, vbNormalFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -