title: Changing file extension associations programatically using MFC?
body: <p>I can use this code in <code>InitInstance</code> to confirm which executable is associated with a given extension:</p>
  
  <pre><code>TCHAR szRegisteredEXE[_MAX_PATH];
  DWORD dwBufferLen = _MAX_PATH;
  
  HRESULT  hRes = AssocQueryString(ASSOCF_NONE, ASSOCSTR_EXECUTABLE, 
                      _T("MeetSchedAssist.MWB"), NULL, szRegisteredEXE, &amp;dwBufferLen);
  if (hRes == S_OK)
  {
      // TODO
  }
  </code></pre>
  
  <p>It works fine.</p>
  
  <p>My software installs a 32 bit version and a 64 bit version of the executable. So what I would like the code to do is prompt to update the associations if the registered exe is not the active exe.</p>
  
  <p>I know how to get my active exe path and how to confirm if it matches <code>szRegisteredEXE</code> but how to I then deal with updating the file associations (assuming the user says yes to the prompt to associate)?</p>