title: Finding the default application for opening a particular file type on Windows
body: <p>I'm developing an application targeting .NET Framework 2.0 using C# for which I need to be able to find the default application that is used for opening a particular file type.</p>
  
  <p>I know that, for example, if you just want to open a file using that application you can use something like:</p>
  
  <pre><code>System.Diagnostics.Process.Start( "C:\...\...\myfile.html" );
  </code></pre>
  
  <p>to open an HTML document in the default browser, or</p>
  
  <pre><code>System.Diagnostics.Process.Start( "C:\...\...\myfile.txt" );
  </code></pre>
  
  <p>to open a text file in the default text editor.</p>
  
  <p>However, what I want to be able to do is to open files that don't necessarily have a <em>.txt</em> extension (for example), in the default text editor, so I need to be able to find out the default application for opening <em>.txt</em> files, which will allow me to invoke it directly.</p>
  
  <p>I'm guessing there's some Win32 API that I'll need to P/Invoke in order to do this, however a quick look with both Google and MSDN didn't reveal anything of much interest; I did find a very large number of completely irrelevant pages, but nothing like I'm looking for. </p>