-
May 18th, 2011, 05:22 PM
#1
ExtractAssociatedIcon
I have an icon file name specified arbitrarily as
filename, filename.ico, filename.exe etc
How can I use this function to extract the main icon from the file ?
My attempt was
WORD id;
HICON hc=ExtractAssociatedIcon(0, szfilename, &id);
where szfilename specified tha path to the icon file.
But the icon displayed as an unknown file icon.
If I changed it into
WORD id=0;
HICON hc=ExtractAssociatedIcon(0, szfilename, &id);
then I would get icons with black background (without transparancy)
Any advice please ?
Thank you.
-
May 20th, 2011, 09:49 AM
#2
Re: ExtractAssociatedIcon
Originally Posted by Sharpie
My attempt was
WORD id;
HICON hc=ExtractAssociatedIcon(0, szfilename, &id);
where szfilename specified tha path to the icon file.
But the icon displayed as an unknown file icon.
Perhaps, uninitialized id contains some garbage, so it cannot be treated as the valid icon index?
Originally Posted by Sharpie
If I changed it into
WORD id=0;
HICON hc=ExtractAssociatedIcon(0, szfilename, &id);
then I would get icons with black background (without transparancy)
Any advice please ?
But this function does not display the icon! How do you know its background is black?
Victor Nijegorodov
-
May 20th, 2011, 12:26 PM
#3
Re: ExtractAssociatedIcon
Thanks alot,
I know it because I have tested both of which I have stated above along with the final solution.
In the first case when no value is assigned, the icon is displayed as an unknown icon (it looks like an unidentified file icon in one's folder) while it is displayed as a non-transparent ico-image in the second case. The final solution provides a transparent image that I have no idea why so it does.
-
May 27th, 2011, 02:49 PM
#4
Re: ExtractAssociatedIcon
Hello, anybodys here ?
I would like to display icons in my listview control (report style), and as mentioned some icons extracted with initialised iconID equal to 0 result in non-transparent background images. Therefore, in Vista or Win7 I can still see the icon of a selected item but in XP the selected highlight color turns it off completely. Have you ever had this problem before ?
Thank you.
-
May 27th, 2011, 02:56 PM
#5
Re: ExtractAssociatedIcon
Which icons?
How do you display them in the listview control? Could you show your code?
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|