Article View: borland.public.cppbuilder.nativeapi
Article #3171Re: LoadImage Vs ExtractIcon
From: Mike Collins
Date: Thu, 31 Aug 2006 22:34
Date: Thu, 31 Aug 2006 22:34
53 lines
3103 bytes
3103 bytes
Still can't get it to work. I've tried removing the flags altogether and just specifying the hight and width but it still fails. I know the icons are there because i've used microangelo and other resource hackers to examine them. WinXP Home and Pro and 2k3 all have 238 icon objects and the Id's 132 & 163 are perfectly valid. I don't understand how to use the api if i do specify LR_DEFAULTSIZE but want to load a specific size icon i.e. if i want to display the x16 or x48 icon. "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:44f7214f$1@newsgroups.borland.com... > > "Mike Collins" <its@TheBottomOfThePost.com> wrote in message > news:44f6ea84$1@newsgroups.borland.com... > >> Image->Picture->Icon->Handle = LoadImage(hDLL, >> MAKEINTRESOURCE(12), IMAGE_ICON, 32, 32, >> LR_DEFAULTSIZE); > > You must specify 0 for the cxDesired and cyDesired parameters if you use > the > LR_DEFAULTSIZE flag. This allows the OS to decide which dimensions to > load > from the image based on the current display settings. > >> is it necessary to free the handle that is returned from >> LoadImage using DestroyIcon? > > Yes, but you do not have to do it yourself. TIcon takes ownership of the > HICON and will free it for you when the TIcon itself is freed, or if you > assign a new HICON to it. > >> i'm having a problem using LoadImage to load icons from shell32.dll. To >> avoid any possible copyright issues, i'm loading some Windows icons > directly >> from \\system32\\shell32.dll, using exactly the same code as above. > However, >> LoadImage seems to fail if i try to load an icon that has an Id grater > than 56. > > Without actually seeing the icons for your copy of shell32.dll, my guess > would be that the icons at those higher IDs don't have 32x32 versions > available for them. You have hard-coded the cxDesired and cyDesired > parameters to always load 32x32 images only. > > Which exact IDs are you trying to load? For example, in my copy of > shell32.dll on Win98, there are no icon groups available between IDs > 47-132. > > > Gambit > >
Technical Details
Message-ID:
<44f7640a@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<44f6ea84$1@newsgroups.borland.com> <44f7214f$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b9f657fbba67ecb4 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Mike Collins" <its@TheBottomOfThePost.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <44f6ea84$1@newsgroups.borland.com> <44f7214f$1@newsgroups.borland.com> Subject: Re: LoadImage Vs ExtractIcon Date: Thu, 31 Aug 2006 23:34:48 +0100 Lines: 55 Organization: SDA Ltd X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.2663 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2757 NNTP-Posting-Host: 81.2.92.14 Message-ID: <44f7640a@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1157063690 81.2.92.14 (31 Aug 2006 15:34:50 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail