IconInfo

Returns information about the icons in an EXE/DLL or ICO file.

Syntax:

IconInfo(filename, filetype)

Parameters:

(s) filename specifies a fully qualified filename of the file from which the icon information will be returned.

(i) filetype specifies the type of file:
0 = EXE or DLL (Win32)
1 = ICO file

Returns:

(a) info an array of icon information.

 

For filetype 0, the array is a three-dimension array in the following format:

arr[0,0,0] = number of icon groups in the file

arr[1,*,*] = icon group 1

arr[2,*,*] = icon group 2 (if any)

etc.

 

For each icon group 'x':

arr[x,0,0] = number of icon images in the group

arr[x,0,1] = the string "WIDTH"

arr[x,0,2] = the string "HEIGHT"

arr[x,0,3] = the string "COLOR DEPTH"

 

Then, for each icon image 'y' in the group:

arr[x,y,0] = image index, where the first image in the group is 1

arr[x,y,1] = image width, in pixels

arr[x,y,2] = image height, in pixels

arr[x,y,3] = image color depth, in bits

 

For filetype 1, the array is a two-dimension array in the following format:

arr[0,0] = number of icon images in the file

arr[0,1] = the string "WIDTH"

arr[0,2] = the string "HEIGHT"

arr[0,3] = the string "COLOR DEPTH"

 

arr[1,*] = icon image 1

arr[2,*] = icon image 2 (if any)

etc.

 

For each icon image 'x':

arr[x,0] = image index, where the first image in the file is 1

arr[x,1] = image width, in pixels

arr[x,2] = image height, in pixels

arr[x,3] = image color depth, in bits

 

The "color depth" value is the number of bits per pixel. This corresponds to the number of colors as follows:

Depth

Colors

1

2

2

4

4

16

8

256

16

65536

24

16 million

32

4 billion

 
Example:


arr = IconInfo(StrCat(DirWindows(0),"notepad.exe"), 0)
groups = arr[0,0,0]
info = ""
For i = 1 To groups
   info = StrCat(info, "Group #",i,@CRLF,"--------",@CRLF)
   icons = arr[i,0,0]
   For j = 1 To icons
      info = StrCat(info, "Icon #",j,@CRLF,"--------",@CRLF)
      For k = 1 To 3
         info = StrCat(info, @TAB, arr[i,0,k], " = ", arr[i,j,k],@CRLF)
      Next
   Next
Next
Message("Icon Info",info)
Exit
See Also:

IconExtract, IconReplace