Associating File Types with my application

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • vdurbal
    Indigo Rose Customer
    • Dec 2008
    • 3

    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
  • Ulrich
    Indigo Rose Staff Member
    • Apr 2005
    • 5131

    #2
    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

    Comment

    • vdurbal
      Indigo Rose Customer
      • Dec 2008
      • 3

      #3
      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

      Comment

      • jassing
        Indigo Rose Customer
        • Jan 2001
        • 3124

        #4
        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

        Comment

        Working...
        X