-
November 20th, 2000, 05:33 AM
#1
Size of Icon
Hi all!
How to get the size of an Icon? I just have a HICON, and need it's dimensions.
Any help? (Rating guranteed ;-)
Peter
-
November 20th, 2000, 05:48 AM
#2
Re: Size of Icon
Hi,
Maybe this will help youICONINFO icoInfo;
BITMAP bmpInfo;
GetIconInfo(hIcon, &icoInfo);
CBitmap::FromHandle(icoInfo.hbmMask)->GetBitmap(&bmpInfo);
Tell me if that help.
Regards,
Emi.
Regards,
Emanuel Vaduva
-
November 20th, 2000, 05:49 AM
#3
Re: Size of Icon
Try GetIconInfo and GetDIBits after that
Rating isn't important...But gurus respect it and keep high
-
November 20th, 2000, 07:31 AM
#4
Re: Size of Icon
Thanks!
I already thought of that - but I was looking for a better way. As much as I understand the documentation, the bitmaps are copies of the icon, I'd like to avoid that...
Peter
-
November 20th, 2000, 07:42 AM
#5
Re: Size of Icon
You are welcome.
Maybe you checked in MSDN at: "Reading and Writing Icons from ExtractIcon". If not see that, maybe it could help you.
Regards,
Emi.
Regards,
Emanuel Vaduva
-
November 20th, 2000, 09:39 AM
#6
Re: Size of Icon
IMHO, the main problem is the size of an icon doesn't mean anything. For example, an icon may contain several bitmaps (4 max., if I remember well), each bitmap may have a different size. So what is the size of an icon in this case ?
Another example: an icon may have only one bitmap, 16 x 16 pixels, but there's no problem to display this icon in 32x32...
So the only information about the size is the "primary" size(s) of the contained bitmap(s), which you can get with the previously described method.
HTH?
K.
We're talking ****, 'cause life is a 'biz
You know it is
Everybody tryin' to get rich
God ****!
All I wanna do is live !
KoRn, Children of the Korn
-
November 20th, 2000, 12:23 PM
#7
Re: Size of Icon
Hi,
Yes, Icon *Resources* can be in multiple sizes & color depths, but when loaded and as a HICON, it has a definite size & depth (a MSDN suggests it's internally represented as some DDB's).
I get the HICON from caller, and the actual size to position it correctly. And I thought the GetIconInfo (which extracts copies of the DDB's) is a bit of a kludge. but it seems it's the only way by now.
Peter
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
|