- Home
·
- Registry
·
- Create File association in 10 lines of code (VerySimple)
Create File association in 10 lines of code (VerySimple)
Create File association in 10 lines of code (VerySimple)
API Declarations
In a form place the following code
Rate Create File association in 10 lines of code (VerySimple)
(2(2 Vote))
associate ".jpg", "JPGFile", "C:\Program Files\Accessories\MSPAINT.EXE"
Unload Me
End Sub
Public Sub associate(EXT As String, FileType As String, FileName As String)
On Error Resume Next
Dim b As Object
Set b = CreateObject("wscript.shell")
b.regwrite "HKCR\" & EXT & "\", FileType
b.regwrite "HKCR\" & FileType & "\", "MY file"
b.regwrite "HKCR\" & FileType & "\DefaultIcon\", FileName
b.regwrite "HKCR\" & FileType & "\shell\open\command\", FileName & " %L"
b.regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & EXT & "\Application"
b.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & EXT & "\Application", FileName
b.regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & EXT & "\OpenWithList\"
b.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & EXT & "\OpenWithList\a", FileName
End Sub
Create File association in 10 lines of code (VerySimple) Comments
No comments yet — be the first to post one!
Post a Comment