📄 flieassociation.bas
字号:
Attribute VB_Name = "Module4"
Option Explicit
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Const HKEY_CLASSES_ROOT = &H80000000
Const REG_DWORD As Long = 4
Const REG_SZ As Long = 1
Public Sub Association()
Dim hKey As Long
hKey = HKEY_CLASSES_ROOT
Dim ret1 As Long
RegSetValue hKey, "Ocx", REG_SZ, "Ocx", 7
RegSetValue hKey, "OcxFile", REG_SZ, "OcxFile", 9
RegSetValue hKey, "OcxFile" & "\shell", REG_SZ, "open", 5
RegSetValue hKey, "OcxFile" & "\shell\open\command", REG_SZ, (App.Path & "\" & App.EXEName & ".exe %1"), LenB(StrConv((App.Path & "\" & App.EXEName & ".exe %1"), vbFromUnicode)) + 1
RegSetValue hKey, "OcxFile" & "\DefaultIcon", REG_SZ, (App.Path & "\" & App.EXEName & ".exe,0"), LenB(StrConv((App.Path & "\" & App.EXEName & ".exe,0"), vbFromUnicode)) + 1
RegCloseKey hKey
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -