title: How to replicate ShellExecuteEx failure with ERROR_NO_ASSOCIATION error?
body: <p>My application displays a report to its end-users by composing it into an <code>.htm</code> file that is placed into a user's temp folder (that is derived by calling <code>GetTempPath</code> API). It is then shown to the user with the code as such:</p>
  
  <pre><code>//strCmd == file:///C:/Users/UserName/AppData/Local/Temp/My_Report.htm
  
  SHELLEXECUTEINFO sei = {0};
  sei.cbSize = sizeof(sei);
  sei.fMask = SEE_MASK_FLAG_NO_UI;
  sei.nShow = SW_SHOW;
  sei.lpVerb = L"open";
  sei.lpFile = strCmd.GetBuffer();
  sei.hwnd = hParentWnd;
  
  BOOL bInitialized = SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE));
  
  if(ShellExecuteEx(&amp;sei))
  {
      //Success
  }
  else
  {
      //Failed
      REPORT_ERROR(GetLastError());
  }
  
  if(bInitialized)
  {
      CoUninitialize();
  }
  </code></pre>
  
  <p>I just got a bug report from a customer that shows that the code above reports <code>ERROR_NO_ASSOCIATION</code>. The OS from the picture I got looks like Windows 8.1, or maybe Windows 7.</p>
  
  <p>So I've been trying to replicate it in a VM by removing all file associations for the <code>.htm</code> and <code>.html</code> file extensions, but <code>ShellExecuteEx</code> never seems to fail. On Windows 10 it always opens up Edge and on Win 8.1 it showed this popup:</p>
  
  <p><a href="https://i.stack.imgur.com/8Q2OQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Q2OQ.png" alt="enter image description here"></a></p>
  
  <p>Does anyone know how I can replicate that error?</p>