LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Access to different pages of a .ico-file

Hi,

I use the command "GetBitmapFromFile" to get an ID for a .ico-file. The problem now is that the icon file has two pages with icons of different resolution.
When visualizing the icon by the ID the first page with the higher resolution is shown but I would need the lower resolution.
Is there any possibility to get access to the different pages of a ico-file?

Thanks in advance
0 Kudos
Message 1 of 2
(3,227 Views)
See the windows SDk Documentation under the Icon topics - ExtractAssociatedIcon

The ExtractAssociatedIcon function returns a handle to an indexed icon found in a file or an icon found in an associated executable file.

HICON ExtractAssociatedIcon(
HINSTANCE hInst, // application instance handle
LPTSTR lpIconPath, // file name
LPWORD lpiIcon // icon index
);

Parameters
hInst
[in] Specifies the instance of the application calling the function.
lpIconPath
[in] Pointer to a string that specifies the full path and file name of the file that contains the icon. The function extracts the icon handle from that file, or from an executable file associated with that file.
If the icon handle is obtained from an executable file, the function stores the full path and file name of that executable in the string pointed to by lpIconPath.

lpiIcon
[in] Pointer to a WORD that specifies the index of the icon whose handle is to be obtained.
If the icon handle is obtained from an executable file, the function stores the icon's identifier in the WORD pointed to by lpiIcon.

Return Values
If the function succeeds, the return value is an icon handle. If the icon is extracted from an associated executable file, the function stores the full path and file name of the executable file in the string pointed to by lpIconPath, and stores the icon's identifier in the WORD pointed to by lpiIcon.

If the function fails, the return value is NULL.

Remarks
The ExtractAssociatedIcon function first looks for the indexed icon in the file specified by lpIconPath. If the function cannot obtain the icon handle from that file, and the file has an associated executable file, it looks in that executable file for an icon. Associations with executable files are based on file name extensions, are stored in the per-user part of the registry, and can be defined using File Manager's Associate command.
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
0 Kudos
Message 2 of 2
(3,190 Views)