Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Loading icons other than BMP at runtime?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Loading icons other than BMP at runtime?

 Post Reply Post Reply
Author
Message
Spyder View Drop Down
Newbie
Newbie


Joined: 17 November 2004
Location: Australia
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Spyder Quote  Post ReplyReply Direct Link To This Post Topic: Loading icons other than BMP at runtime?
    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?
Back to Top
Spyder View Drop Down
Newbie
Newbie


Joined: 17 November 2004
Location: Australia
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Spyder Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2005 at 6:02pm
bump... nobody has any ideas? :(
Back to Top
robs View Drop Down
Groupie
Groupie


Joined: 09 November 2003
Status: Offline
Points: 84
Post Options Post Options   Thanks (0) Thanks(0)   Quote robs Quote  Post ReplyReply Direct Link To This Post 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


Back to Top
Spyder View Drop Down
Newbie
Newbie


Joined: 17 November 2004
Location: Australia
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Spyder Quote  Post ReplyReply Direct Link To This Post 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...
Back to Top
Spyder View Drop Down
Newbie
Newbie


Joined: 17 November 2004
Location: Australia
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Spyder Quote  Post ReplyReply Direct Link To This Post 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...
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: 18 March 2005 at 7:24am

LoadPicture.Handle retrieve HBITMAP not HICON.

try CommandBars.Icons.AddBitmap instead.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Spyder View Drop Down
Newbie
Newbie


Joined: 17 November 2004
Location: Australia
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Spyder Quote  Post ReplyReply Direct Link To This Post 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.
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.164 seconds.