🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6728

Re: GDI and User Objects Overflow

#6728
From: Mark Jacobs
Date: Mon, 18 Apr 2005 15:23
61 lines
3344 bytes
Jonathan Benedicto wrote:
> Why don't you use SHGetFileInfo to get a image list of the icons and 
> to get the image index of the icon for each file.
> 
> That is how TurboPower's ShellShock works their controls.

Thanks for your reply. The reason is because ExtractAssociatedIcon does more 
than the Shell function you mention. Here is its help file description :-

The ExtractAssociatedIcon function returns the handle of 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,	// path and filename of file for which icon is wanted
     LPWORD lpiIcon 	// pointer to icon index
    );	

Parameters

hInst

Specifies the instance of the application calling the function.

lpIconPath

Points to a string that specifies the full path and filename of the file for 
which an icon is desired. 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 filename of that executable in the string pointed to by 
lpIconPath.

lpiIcon

Points 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 filename 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 filename extensions, are stored in the per-user part of the registry, and 
can be defined using File Manager's Associate command.

-- 
Mark Jacobs
http://www.dkcomputing.co.uk
Technical Details
Message-ID: <4263d0b2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!peer01.west.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4263c64a$1@newsgroups.borland.com> <4263c97c@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c7f7d55dbf4194d8
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Mon, 18 Apr 2005 16:23:13 +0100
From: Mark Jacobs <http://www.jacobsm.com/mjmsg.htm?mj@critical>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: GDI and User Objects Overflow
References: <4263c64a$1@newsgroups.borland.com> <4263c97c@newsgroups.borland.com>
In-Reply-To: <4263c97c@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 81.144.157.8
Message-ID: <4263d0b2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1113837746 81.144.157.8 (18 Apr 2005 08:22:26 -0800)
Lines: 61
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!peer01.west.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail