Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - ImageManager.AddIcon using ExtractIcon
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ImageManager.AddIcon using ExtractIcon

 Post Reply Post Reply
Author
Message
Shawshank View Drop Down
Senior Member
Senior Member


Joined: 16 October 2005
Status: Offline
Points: 117
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shawshank Quote  Post ReplyReply Direct Link To This Post Topic: ImageManager.AddIcon using ExtractIcon
    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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Shawshank View Drop Down
Senior Member
Senior Member


Joined: 16 October 2005
Status: Offline
Points: 117
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shawshank Quote  Post ReplyReply Direct Link To This Post Posted: 24 February 2006 at 8:51am
Many, many thxs. That did the trick!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.