|
-
Jun 4th, 2001, 03:44 AM
#1
Thread Starter
New Member
Allocating a icon to an unknown file by running a exe or dll or something somehow???
How do I allocate a icon to a unknown file extension through code???
An obsession about sunflower is not always bad!!
-
Jun 5th, 2001, 02:41 AM
#2
Junior Member
allocating a icon
unknown filextension ?
please, can u make it clear
if file extension is known you can allocate an icon to it
-
Jun 5th, 2001, 05:19 AM
#3
Thread Starter
New Member
I create a file with a file extension for example .krs.
Now I want to add this file extension to the registry.
So for I can do that, but I want to allocate a icon to the files with that file extension. I got it working but now I cant seem to get it right again.
An obsession about sunflower is not always bad!!
-
Jun 5th, 2001, 07:14 AM
#4
Junior Member
Will this help you
I think that you should associate the extension correctly in the registry.also you could change the registry key below if you want to change the associated icon
"HKEY_CLASSES_ROOT\Mari\DefaultIcon" with correct path of the icon in the "Default" string value
Please try this code
Private Sub Form_Load()
associate ".krs", "Mari", "C:\MARI.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 ' Here you should specify the path 0f the icon
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|