Print Page | Close Window

Adding icons to ImaageManager .AddIcon

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=3686
Printed Date: 28 April 2024 at 11:58am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Adding icons to ImaageManager .AddIcon
Posted By: Shawshank
Subject: Adding icons to ImaageManager .AddIcon
Date Posted: 22 February 2006 at 12:26am

I am attempting to dynamically load file type association icons into the ImageManager. This means some times the icon is a full path to a .ico file or it can be indexed into a library file or EXE. In this latter case I use ExtractIcon to get the handle. That works fine. It isn't until I try to add the icon to the ImageManager via .AddIcon that I have trouble. ExtractIcon provides me with a handle and I assign that to the ImageManager.AddIcon property. Checking the Watch window I see that the .Count property for the ImageManager.Cont property has increased by one. This leads me to believe that it was successful. When I then attempt to add the icon from the Imagemanager to the ReportRecordItem that trouble occurs. It simply doesn't appear --even after a .Populate call.

iPos% = InStrRev(sIconPath$, ",")
        
If iPos% Then
        
      iIdx% = Mid$(sIconPath$, (iPos% + 1))
             
      sIconPath$ = Left$(sIconPath$, (iPos% - 1))
             
      sIconPath$ = Replace(sIconPath$, """", "")
             
       If gFSO.FileExists(sIconPath$) Then
             
                 hIcon& = ExtractIcon(frmMain.hWnd, sIconPath$, iIdx%)
        
        End If

End If

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

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

Me.rc.Records.Record(lIdx&).Item(1).Icon = lIconIdx&

I have no trouble using .LoadIcon. Is there something wrong with the code above? Should it not work? Any insight would be greatly appreciated!




Replies:
Posted By: Shawshank
Date Posted: 24 February 2006 at 8:53am
Using ExtractIconEx solved the issue. ExtractIcon loads 32x32 by default.



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