CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2011
    Posts
    38

    Setting default file type associations

    I have converted a project from VC++2010 to VC# 2015 but can't get the new version to run on clicking the files in file explorer. I have built a release version but after I browse to the file in "choose default program" dialog it doesn't set it. Either the original version built in VC++ runs or if I delete that .exe the "choose program" dialog comes up. If I build the original VC++ under VC++ 2015 that works ok. Also the program runs ok from a link/icon and drag/drop multiple files onto the icon or open app. also works.

    I wonder if this is a free version limitation but doubt that as the 2015 VC works ok.

    Does anybody have any idea what's wrong?

    The files are *.fit astronomical image files and the app is for processing and displaying them.

    NB: I have re-installed VS several times (from a .iso image using iso opener) and the install took ages (~ 6+ hours!)
    Thanks

    Windows 7 pro SP1, net vs 4.6.00081, VS Community 2015 vs 14.0.23107.0 D14REL

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,495

    Re: Setting default file type associations

    There are several ways to do this. One way is to use Visual Studio to create a setup project. Another way is direct registry manipulation.

    Search bing or google for "registering file associations in C#"

  3. #3
    Join Date
    Jun 2011
    Posts
    38

    Re: Setting default file type associations

    Thanks Arjay
    I'm not looking to create an installer just yet - first I would like to get file associations working manually under windows. As I said this works with C++ (and all other non-installer apps I have used before) but not C# and I suspect this may be the case with an installer also.

    This is what I do:-

    In Windows File Explorer I right click on a ".fit" file and choose "Open with... > Choose default program"

    In the "Open with" dialog I check the "Always use..." box then click "Browse" and select my release .exe file.

    When I click on the .exe file nothing happens and any existing default remains active. The icon for my program does not appear in the programs window.

    I have looked through the property pages for the project but can't see anything that looks as if it might be relevant.

  4. #4
    Join Date
    Jun 2011
    Posts
    38

    Re: Setting default file type associations

    I built install using Publish in properties and ran the installer. Don't know if I set it up correctly but the program installed and appeared in Installed Programs. As anticipated it didn't hook the file type (.tif).

    A simple forms program called anything other than my program name ("CoFits") works.
    All programs -including- "CoFits" work under VC++.
    The same behaviour manifests on all 3 of my Win7 machines including one with VS not installed.

    Made a copy and re-named it "CoView" and that works!

    Is there some setting which can cause this weird behaviour? i.e. any program named "CoFits" and compiled under VC# is blocked from file type associations in "Choose default program...".
    Last edited by RogerD; March 18th, 2016 at 08:34 AM.

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

Featured