Results 1 to 4 of 4

Thread: Allocating a icon to an unknown file by running a exe or dll or something somehow???

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2001
    Location
    South Africa - Gauteng
    Posts
    5

    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!!

  2. #2
    Junior Member
    Join Date
    Nov 2000
    Location
    Kalpetta,Wayanad,Kerala,india
    Posts
    25

    Question allocating a icon

    unknown filextension ?
    please, can u make it clear
    if file extension is known you can allocate an icon to it

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2001
    Location
    South Africa - Gauteng
    Posts
    5
    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!!

  4. #4
    Junior Member
    Join Date
    Nov 2000
    Location
    Kalpetta,Wayanad,Kerala,india
    Posts
    25

    Unhappy 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
  •  



Click Here to Expand Forum to Full Width