Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>FIRST</strong>, you need to set up file association, so that your file type is associated with your application and opening the file type will run your application.</p> <p>You can do the file association programatically, there is some detail here as mentioned: <a href="http://www.codeproject.com/KB/dotnet/System_File_Association.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/dotnet/System_File_Association.aspx</a></p> <p>You can also do it via your Setup project for you application if you have one. This is an <strong>easier</strong> path for "newbies". Details for using visual studio to get the setup project to add the file association and also set the icon for the file are here: <a href="http://www.dreamincode.net/forums/topic/58005-file-associations-in-visual-studio/" rel="nofollow noreferrer">http://www.dreamincode.net/forums/topic/58005-file-associations-in-visual-studio/</a></p> <p>Otherwise if you use InnoSetup, Wix etc then I suppose you could just see instructions for those installers to create the association for you.</p> <p><strong>SECOND</strong>, you need to have your application accept command line arguments. The opened file(s) is(are) passed as a command line argument(s). You need to process the arguments to get the file path/name(s) and open the given file(s). There is a nice description of this here with code: <a href="https://stackoverflow.com/questions/728317/c-command-line-arguments-problem-in-release-build/730545#730545">C# Command Line arguments problem in Release build</a></p> <p>In your case, rather than <code>MessageBox.Show(s)</code> in the form shown handler, you would call your bespoke argument parsing method. For a simple application which only accepts files names to open as arguments, this could be as simple as</p> <pre><code>foreach (string filePathName in Args) DoNamedFileOpen(filePathName); </code></pre> <p>Your code can also have a method that might extract from the file the values for the datafields you are interested in etc.</p> <p>This is a nice simple approach to the issue of have file associations set on installation of your application, with icons, and having your application handle the opening of those files. </p> <p>Of course, there are plenty of other options, like run-time file association (asking the user if they want the association), detecting "broken" associations, etc.</p> <p>This question is a long time here but I hope this is useful for new searches</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload