Solved

Small Icons

Posted on 1998-03-21
6
171 Views
Last Modified: 2010-04-06
I've seen Windows 95 show the icons as 18x18, how do I stretch my icons in Delphi 2 to this size ?  They have to be icons because I'm extracting them from exe's, but I want them smaller on my buttons.

Darren
0
Comment
Question by:Dazza051197
  • 3
  • 2
6 Comments
 
LVL 4

Accepted Solution

by:
BoRiS earned 300 total points
ID: 1360679
Check out the SHGetFileInfo API call there is a flag under there that lets you return a small icon

I think it's called SHGF_SMALLICON (the flag) can't remember right now

any problems just ask I'll help

BoRiS
0
 
LVL 1

Author Comment

by:Dazza051197
ID: 1360680
How do I get the handle to the icon though ?  I looked up the SHGetFileInfo routine in the Windows API and it tells me it's going to give me a handle to the system image list ?
I'll increase to 300 points if you can provide a Delphi 2 example to return a small TIcon from a filename provided.
Daz

0
 
LVL 3

Expert Comment

by:williams2
ID: 1360681
Not that I'm going to interfear with BoRiS's excellent answer (Thanks), I have been looking for that API myself. Anyway, When you get the handle to an Imagelist, you can pass it to severel other API's (Try look up ImageList_GetIcon in Delphi help) It's not that difficult at all. I f you just know the index value, one more call should do it.

Afterwards do like:
Icon:= TIcon.Create;
Icon.Handle:= hICON;
..And that's it

Regards
Williams
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 4

Expert Comment

by:BoRiS
ID: 1360682
try this....

uses
  ..., ShellApi;

procedure TForm .........
var
  SmallIco: TIcon;
  shfi: TShFileInfo;
begin
  SmallIco := TIcon.Create;
  ZeroMemory(@shfi, SizeOf(shfi));
  ShGetFileInfo('C:\MyFile.exe', 0, shfi, SizeOf(shfi), SHGFI_SMALLICON);
  SmallIco.Handle := shfi.hIcon;
  ... {rest of coding}
  SmallIco.Free;
end;

got this from a good friend, maybe you know him...
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1360683
Dazza

Please grade this answer

Thank You

BoRiS
0
 
LVL 1

Author Comment

by:Dazza051197
ID: 1360684
Sorry for the delay, been tied up with other things.
Your answer works a treat, thanks.
Daz

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now