Print Page | Close Window

Loading icons other than BMP at runtime?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1966
Printed Date: 02 July 2024 at 6:38pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Loading icons other than BMP at runtime?
Posted By: Spyder
Subject: Loading icons other than BMP at runtime?
Date Posted: 14 March 2005 at 7:05pm
I need to load files that could be gif, jpg or bmp at runtime as toolbar icons.

The AddIcon() method claims to take a handle to an icon, but this doesn't work (VB6):

Call CommandBars.Icons.AddIcon(LoadPicture("path\to\image.gif").H andle, newBtn.id, xtpImageNormal)


Anyone had luck loading a picture that isn't a BMP?



Replies:
Posted By: Spyder
Date Posted: 16 March 2005 at 6:02pm
bump... nobody has any ideas? :(


Posted By: robs
Date Posted: 16 March 2005 at 6:36pm
Try this:
http://www.vbaccelerator.com/home/VB/Code/Controls/ImageLi st/index.asp

I use it for icons w command bar. Works good.

I think I've tried gif and it worked. Can't remember.

good luck




Posted By: Spyder
Date Posted: 16 March 2005 at 7:05pm
I thought about using something like that, but I'd rather not add that much code just for this.

Maybe I can extract just the load picture code, hrmm. It doesn't help that the AddIcon() method documentation does not specify how to specify an image handle...


Posted By: Spyder
Date Posted: 18 March 2005 at 12:54am
OK that nearly worked, but the VBALImageList doesn't support loading images that are different dimensions to the one defined internally.

Guess I'll have to submit this as a support request...


Posted By: Oleg
Date Posted: 18 March 2005 at 7:24am

LoadPicture.Handle retrieve HBITMAP not HICON.

try CommandBars.Icons.AddBitmap instead.



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


Posted By: Spyder
Date Posted: 20 March 2005 at 4:46pm
That worked, thanks!

You may want to document that method, I couldn't find it in the docs anywhere.



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