title: Compliant loading of small OEM icon with LoadImage
body: <p>I believe what my code complies to <a href="http://msdn.microsoft.com/en-us/library/ms648045(VS.85).aspx" rel="nofollow noreferrer"><code>LoadImage</code></a> specification, but despite of explicitly specified dimensions, loaded image is largest non-PNG icon.</p>
  
  <pre><code>procedure TForm1.FormCreate(Sender: TObject);
  begin
    Image1.Picture.Icon.Handle := LoadImage(
      0,
      MakeIntResource(OIC_SHIELD),
      IMAGE_ICON,
      GetSystemMetrics(SM_CXSMICON),
      GetSystemMetrics(SM_CYSMICON),
      LR_SHARED
    );
    Win32Check(Image1.Picture.Icon.HandleAllocated);
  
    OutputDebugString(PChar(Format('%d×%d', [
      Image1.Picture.Icon.Width, 
      Image1.Picture.Icon.Height
    ]))); //  128×128
  end;
  </code></pre>
  
  <p>Note: i prefer to be compliant to newer <code>LoadImage</code> semantics rather than to rely on the explicit module and resource id (essentially falling back to <code>LoadIcon</code> semantics) as specified in the answer to <a href="https://stackoverflow.com/questions/4285890/how-to-load-a-small-system-icon">this question</a>.</p>
  
  <hr>
  
  <p>Quotes from <code>LoadImage</code> specs are exactly outlining my problem with mutually exclusive LoadImage behaviours (either fail or use previously loaded stock resource, ignoring desired dimensions) - see <a href="https://stackoverflow.com/questions/6613513#6614015">Adrian McCarthy's answer</a>.</p>
  
  <hr>
  
  <p>While <code>OIC_SHIELD</code> is Windows 6.0+ specific, the same happens with other stock icons (OIC_xxx constants) present in Windows since version 4.0.</p>