Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 153
  • Last Modified:

ShGetFileInfo and small icons...

how can I use the SHGetFileInfo to retrieve the small icon and assign it to the applications icon

thank you
Rouge
0
rouge
Asked:
rouge
  • 2
1 Solution
 
BoRiSCommented:
rouge

you could try somethng like this...

procedure TForm1.Button1Click(Sender: TObject);
       var
             SmallIco: TIcon;
             shfi: TShFileInfo;
           begin
             SmallIco := TIcon.Create;
              ZeroMemory(@shfi, SizeOf(shfi));
               ShGetFileInfo('D:\Windows\notepad.exe', 0, shfi, SizeOf(shfi), SHGFI_SMALLICON or SHGFI_ICON);
                 SmallIco.Handle := shfi.hIcon;
                   Application.Icon := SmallIco;
                    SmallIco.Free;
           end;

hope this helps....

Later
BoRiS
0
 
BoRiSCommented:
oops sorry that was surposed to be sent as a comment, you may reject this answer if you wish...

Later
BoRiS
0
 
rougeAuthor Commented:
Thank you BoRiS, this is what I needed just a short question can I assign the smallicon to an image component...

Rouge
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now