4

I have a C# WinForm application. This program is designed to create and open specific files (.cus). Files are created using this program and can be opened in same program.

I am using Advanced Installer to create Installer.

After Installation, I need my program to open file(.cus) when it is double clicked. (Just like, If we dblClick .xls file it loads and opens MS Excel if it is there in system.)

How can I achieve this?

I detail answer will be good to understand. Let me know if I need to make it more clear.

Thanks in anticipation.

Bogdan Mitrache
  • 10,536
  • 19
  • 34
Hardik
  • 1,716
  • 6
  • 27
  • 41
  • 2
    not really a duplicate post but have this a try http://stackoverflow.com/questions/4077352/c-sharp-setting-my-application-as-default-app – John Woo Oct 02 '12 at 05:40
  • 1
    See http://stackoverflow.com/questions/2681878/associate-file-extension-with-application or http://stackoverflow.com/questions/69761/how-to-associate-a-file-extension-to-the-current-executable-in-c-sharp for example – dash Oct 02 '12 at 05:50
  • 1
    You should check this http://stackoverflow.com/questions/2681878/associate-file-extension-with-application – ígor Oct 02 '12 at 05:51
  • Searching for Advanced Installer File Associations yields [this page](http://www.advancedinstaller.com/user-guide/file-associations.html) – Damien_The_Unbeliever Oct 02 '12 at 05:55

1 Answers1

5

You need to get your installation package to create the file association in Windows when you install your application. I am not sure how to achieve this in Advanced Installer, but most installation packages will allow you to do this. You will also need to make sure your Winforms application accepts a file path as a parameter to the Main(string[] arg) method, which windows will set to be the .cus file you double clicked on.

Scott Baldwin
  • 431
  • 2
  • 10
  • This seems to be how to achieve it in Advanced Installer http://www.advancedinstaller.com/user-guide/file-associations.html – Scott Baldwin Oct 02 '12 at 06:00