Board index » delphi » Extract Icon Win 32 API

Extract Icon Win 32 API

how to get th number of icon in exe or dll file with the Win32 function
ExtractIcons
in delphi 2 and 3 is work with -1 in the parameter
but in delphi 4 the last parameter is cardinal type (the minimum value is 0)

thanks
Efiguti

 

Re:Extract Icon Win 32 API


Quote
Efiguti wrote:

> how to get th number of icon in exe or dll file with the Win32
> function ExtractIcons
> in delphi 2 and 3 is work with -1 in the parameter
> but in delphi 4 the last parameter is cardinal type (the minimum
> value is 0)

> thanks
> Efiguti

Sheesh, is that STILL going on?

The original ShellAPI unit for TPW/BPW and Delphi 1.0 had the nIconIndex
parameter given as type Word; with the same problem.  

The D3 ShellAPI unit shows it as a "UInt" which I understood to
represent an "unsigned integer" from Windows C/C++.  However, the D3
WINDOWS.PAS unit defines UInt = Integer; which is definitely NOT
unsigned; hmmmm.

Anyways, try typecasting:

IconCount := ExtractIcon(
  Application.Handle,
  'SOMEPROG.EXE',
  Cardinal( -1 )) ;

HTH

Stephen Posey
slpo...@concentric.net

Other Threads