Announcement

Collapse
No announcement yet.

Associating File Types with my application

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • jassing
    replied
    Originally posted by vdurbal View Post
    Hello,

    I was wondering how, using SF, I can set the file type extension for files that are opened by my application (e.g. "*.test"). Within the VS 2005 installer, you just select the "File Types" tab and create it directly, setting the icon and extension. How do I do this in SF? Thank you.

    Vijay
    Here's some code from my toolkit:

    Code:
      function File.SetAssocation(cExt, cExe, cIcon, cShort,cLong)
        -- Set the file association for the given file.
      	local cKey = cShort..".Document";
      	Registry.SetValue(HKEY_CLASSES_ROOT, cExt, "", cKey);
      	Registry.SetValue(HKEY_CLASSES_ROOT, cKey, "",cLong);
      	Registry.SetValue(HKEY_CLASSES_ROOT, cKey.."\\DefaultIcon","",File.GetShortName(cIcon)..",0");
      	Registry.SetValue(HKEY_CLASSES_ROOT, cKey.."\\shell\\open\\command", "", "\""..cExe.."\" \"%1\"");
      end
    
    
      function File.RemoveAssocation(cExt)
        -- Set the file association for the given file.
      	local cKey = Registry.GetValue(HKEY_CLASSES_ROOT, cExt,"")
      	Registry.DeleteValue(HKEY_CLASSES_ROOT, cExt, "");
      	Registry.DeleteValue(HKEY_CLASSES_ROOT, cKey, "");
      	Registry.DeleteValue(HKEY_CLASSES_ROOT, cKey.."\\DefaultIcon", "");
      	Registry.DeleteValue(HKEY_CLASSES_ROOT, cKey.."\\shell\\open\\command", "");
      end

    Leave a comment:


  • vdurbal
    replied
    Thanks, Ulrich. I've searched online for examples on how best to do this but have found conflicting information. Is there an example of doing it in Setup Factory that you can show me or point me to? Thank you.

    Vijay

    Leave a comment:


  • Ulrich
    replied
    Hello,

    there is currently no built-in function for registering file associations, but you can register them manually while installing you application, creating entries in the HKCR hive.

    Ulrich

    Leave a comment:


  • vdurbal
    started a topic Associating File Types with my application

    Associating File Types with my application

    Hello,

    I was wondering how, using SF, I can set the file type extension for files that are opened by my application (e.g. "*.test"). Within the VS 2005 installer, you just select the "File Types" tab and create it directly, setting the icon and extension. How do I do this in SF? Thank you.

    Vijay
Working...
X