title: How to set an application as the default program of opening a certain type of file programmatically?
body: <p>There's an executable file generated from my program in MFC and I want to use it as the default program to open the <code>.jpg</code> files. That is to say, each time I double click a <code>.jpg</code> file, my program will run. </p>
  
  <p>I tried to add some registry entries linking <code>.jpg</code> files with my program, such as <code>HKEY_CLASSES_ROOT\.jpg\shell\open\command</code> (set its value to <code>"myProgram.exe" "%1"</code>), and <code>HKEY_CLASSES_ROOT\myProgram</code>.</p>
  
  <p>The method works just fine except when some other applications register themselves to open the <code>.jpg</code> files. For example, I have installed acdSee on my computer, so each time I doule click a <code>.jpg</code> file, it always start acdSee instead of my own program. But when I register a completely new type of file with my program, it can be open in the program. I don't know how to set my program as the default opening program of an already registered file programmatically. Can anyone help me solve this problem? Thank you very much!</p>