title: Extract high resolution icon or thumbnail for file
body: <p>I'm trying to get a high resolution icon or thumbnail in Windows given a full path to that file. Doesn't <em>need</em> to be a thumbnail — a good looking Icon will be great. I Don't care if it's an <code>HICON</code> or an <code>HBITMAP</code>: I'm going to put it in a GDI+ object and render it into a device context.</p>
  
  <p>I've tried using <code>SHGetFileInfo</code> (with various variations on flags), but never get more than a ~32x32 icon back, which scales horribly to the 128 pixels or so that I need.</p>
  
  <pre><code>if (!SHGetFileInfoW(path, 0, &amp;fi, sizeof(fi),
                      SHGFI_ICON | SHGFI_ICONLARGE | SHGFI_TYPENAME))
      return GetLastError();
  
  // fi.hIcon is a valid icon here, but it's horrible quality with
  // a black mask on it. I want higher quality, and dare I dream of
  // alpha channel? Mask is acceptable, i suppose.
  </code></pre>
  
  <p><code>SHGetFileInfo</code> returns <code>""</code> when I call with <code>SHGFI_ICONLOCATION</code> (which appears to be a known problem with that API).</p>
  
  <p>I've also tried using <code>SHCreateItemFromParsingName</code> name with the intention of getting <code>IThumbnailProvider</code>, but <code>BindToHandler</code> always returns <code>E_NOTIMPL</code> for <code>BHID_ThumbnailHandler</code> ...</p>
  
  <pre><code>IShellItem *psi;
  hr = SHCreateItemFromParsingName(path, NULL, IID_PPV_ARGS(&amp;psi));
  if (SUCCEEDED(hr))
  {
      IThumbnailProvider *pThumbProvider;
      hr = psi-&gt;BindToHandler(NULL, BHID_ThumbnailHandler,
                              IID_PPV_ARGS(&amp;pThumbProvider));
      if (SUCCEEDED(hr))
      { 
      // never get here because hr == E_NOTIMPL !!!
  </code></pre>
  
  <p>I've actually run the Microsoft <a href="http://archive.msdn.microsoft.com/shellapplication" rel="noreferrer" title="Thumbnail Providers Sample">Thumbnail Providers Sample</a> and found that it suffers from the same problem with <code>BindToInterface</code>.</p>
  
  <p>So, any suggestions on what else I could try? I just want something picture-y that more or less represents this file at, say, at least 100px size — just anything better than 32x32 ...</p>