Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You don't say what the purpose of this is, and there are a number of ways of getting icons and one method may be better than another depending on the purpose.</p> <p>However, <strong>to extract any number of "large" (32x32) and/or "small" (16x16) icons* from an arbitrary file</strong>, use the <a href="http://msdn.microsoft.com/en-us/library/ms648069.aspx" rel="noreferrer"><code>ExtractIconEx</code></a> function. This lets you extract one or more icons of either of these two standard sizes from an icon file (.ico), EXE, or DLL. An icon file can contain multiple images and this function will let you get all of them.</p> <p>The function will write to an array of handles, each of which you can assign to the <code>Handle</code> property of a <code>TIcon</code> instance. Then you can use the <a href="http://docwiki.embarcadero.com/VCL/en/Graphics.TIcon" rel="noreferrer"><code>TIcon</code> methods</a> as you normally would if you'd loaded the TIcon any other way. Note that new to Delphi XE is the ability to copy it easily to a bitmap <a href="http://blogs.embarcadero.com/pawelglowacki/2010/05/31/39072" rel="noreferrer">via the Assign method</a>. <a href="http://blogs.embarcadero.com/pawelglowacki/2010/05/31/39072" rel="noreferrer">That article</a> also shows how to <strong>access all of the stock (inbuilt / standard) Windows icons</strong>, if that happens to be what you're after.</p> <p>(Side note: I think the <a href="http://docwiki.embarcadero.com/VCL/en/Graphics.TIcon_Functions" rel="noreferrer"><code>TIcon</code></a> class lets you load from a file via its <code>LoadFromFile</code> method - this seems to be missing from the documentation, but I'm pretty certain it exists. From memory, that only loads a single icon.)</p> <blockquote> <p>(*) Actually, "large" and "small" can be different to 32x32 and 16x16: use the <a href="http://msdn.microsoft.com/en-us/library/ms724385.aspx" rel="noreferrer"><code>GetSystemMetrics</code></a> function with the <code>SM_CXICON</code>, <code>SM_CYICON</code>, <code>SM_CXSMICON</code>, and <code>SM_CYSMICON</code> flags to find out the dimensions of each type.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload