Print Page | Close Window

ImageManager.AddIcon using ExtractIcon

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=3695
Printed Date: 17 November 2024 at 11:43am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ImageManager.AddIcon using ExtractIcon
Posted By: Shawshank
Subject: ImageManager.AddIcon using ExtractIcon
Date Posted: 23 February 2006 at 6:55pm

I am attempting to add an icon to the ImageManager and then subsequently assigning it to a ReportRecordItem. I use the following:

iIdx% = -152

lIconIdx& = (Me.ImageMan.Icons.Count + 1)

sIconPath$ = "C:\Windows\System32\shell32.dll"

hIcon& = ExtractIcon(frmMain.hWnd, sIconPath$, iIdx%)

Me.ImageMan.Icons.AddIcon hIcon&, lIconIdx&, xtpImageNormal

This code certainly returns an icon handle and appears to properly add the icon to the ImangeManager. I see that the ImageManager Icon.Count property increments by one. I then try to assign the icon to the ReportRecordItem like so:

r.Item(1).Icon = lIconIdx&

After calling Me.rc.Populate I see that the text of the ReportRecordItem has shifted to the right somewhat as though the icon was there. However, if it is there it is invisible. I've tried any number of different indexes into the shell32.dll library but all have the same result. I suspect the issue is related to there being multiple icons within a single icon file? If so, is there a way around this? Or, perhaps my code is incorrect?

Thx




Replies:
Posted By: Oleg
Date Posted: 24 February 2006 at 8:04am

Hello,

ExtractIcon by default loads 32*32 icon. Try ExtractIconEx:

ExtractIconEx "C:\Windows\System32\shell32.dll", -152, 0, hIcon, 1



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Shawshank
Date Posted: 24 February 2006 at 8:51am
Many, many thxs. That did the trick!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net