Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6160255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:16:07+00:00 2026-05-23T21:16:07+00:00

I am developing a listview baised on the shell. When trying to extract a

  • 0

I am developing a listview baised on the shell. When trying to extract a shell icon/image… I try to extract thumbnail using IExtractImage if that fail I try to extract icons using IExtractIcon, to get maximum iconsize, but IExtractIcon gives strange results. Problem is I tried to use a methode that extracts icons from an imagelist but if there is no large icon (256×256) it will render the smaller icon at the topleft position of the icon and that does not look good. That is why I am trying to use the IExtractIcon instead. But icons that show up as 256×256 icons in my imagelist extraction methode reports icon sizes as 33 large and 16 small. So how do I check if a large (256×256) icon exists? If you need more info I can provide some sample code.

if PThumb.Image = nil then
begin
  OleCheck(ShellFolder.ParseDisplayName(0, nil, StringToOleStr(PThumb.Name), Eaten, PIDL, Atribute));
  ShellFolder.GetUIObjectOf(0, 1, PIDL, IExtractIcon, nil, XtractIcon);
  CoTaskMemFree(PIDL);
  bool:= False;
  if Assigned(XtractIcon) then
  begin
    GetLocationRes := XtractIcon.GetIconLocation(GIL_FORSHELL, @Buf, sizeof(Buf), IIdx, IFlags);
    if (GetLocationRes = NOERROR) or (GetLocationRes = E_PENDING) then
    begin
      Bmp := TBitmap.Create;
      try
        OleCheck(XtractIcon.Extract(@Buf, IIdx, LIcon, SIcon, 32 + (16 shl 16)));
        Done:= False;

Roy M Klever

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:16:07+00:00Added an answer on May 23, 2026 at 9:16 pm

    Take your 256×256 bitmap and simply check for alpha. Make sure the bmp is 32bits. Any part that has 0 for the pixel value (that is BGRA 0,0,0,0, use TBitmap.Scanline to access) is transparent. You can find the smallest x and smallest y coord that has a nonzero value and that’s the actual size of your icon. Now, this number may be smaller than the “icon size” as it was designed. For instance, a 16×16 icon can contain an image of 2×2, which would be a weird design.

    But of course an 8×16 icon is very well possible. Considering the images are always square, take the max if the x and y coordinates found (with and height of actual image) and round it up to the nearest of 16,24,32,48,64,128 or 256. You can be quite certain that you’ll have the icon centered in your bitmap if you crop to this size next. Use Bmp.Width=sz; Bmp.Height=sz;.
    You could then scale it up, or center it onto your standard bitmap (56×56? 256×256?).

    So, even if windows doesn’t feel like giving you the right info, you can bypass the need for this info by simply finding out yourself. This may not be the “correct” way to do it, but you’ll know that it’ll work when you’re done, as opposed to browsing MSDN for 4 hours and never finding an answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to developing UI in .net. Basically I am using a listview
I am developing an application,In my application,I am using Listview for displaying data using
Hi I am developing one app using the below link Custom ListView With Headers
I am developing an windows application and in this project i am using ListView
I'm developing one android application in which I'm using one customized ListView which extends
I'm developing a component (backend). I got a listview with a $_GET that contains
Actually i'm developing template using asp.net and c#. i'm using listview at my ascx
I am developing an appwidget that uses the RemoteViews to display a ListView. For
I'm Developing an Application. I'm displaying Thumbnail Image and Corresponding data with the image
I am developing a playlist app for Android which has a ListView that contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.