Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Load PNGs from Resource DLL
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Load PNGs from Resource DLL

 Post Reply Post Reply
Author
Message
slvrbllt View Drop Down
Groupie
Groupie
Avatar

Joined: 16 September 2006
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote slvrbllt Quote  Post ReplyReply Direct Link To This Post Topic: Load PNGs from Resource DLL
    Posted: 17 April 2008 at 1:06pm

Hello,

While I am able to load PNGs from a file into a toolbar using the "LoadBitmap" method, I would like to achieve the same result by loading the PNGs at runtime from a resource DLL.
LoadBitmapFromResource did not help me at all...
 
Is there any way of doing this ?
 
Thanks.
S.
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: 17 April 2008 at 1:21pm
Hi,
How did you use LoadBitmapFromResource  ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
slvrbllt View Drop Down
Groupie
Groupie
Avatar

Joined: 16 September 2006
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote slvrbllt Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2008 at 5:18pm
Hi Oleg,
 
I have loaded my PNGs into a .res file as "custom" resources.
The .RC file may look like this:
 
[...]
IDB_TOOLBAR1     PNG    toolbar1.png
IDB_TOOLBAR2     PNG    toolbar2.png
 
I have tried to do something like:
IDB_TOOLBAR1     BITMAP           toolbar1.png
IDB_TOOLBAR2     BITMAP           toolbar2.png
 
but RC complains about the PNG not being valid bitmaps.
 
 
The .RES file is included into my project.
Then I try to load icons into the command bar by using the following call:
 
CommandBars.Icons.LoadBitmapFromResource App.hInstance, IDB_TOOLBAR1, Array(.....), xtpImageNormal
 
(on the final project, App.hInstance should be replaced by a resource only DLL handle)
 
The toolbar gets populated by buttons with text, but "garbage" instead of icons...
 
Where do I fail ?
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 April 2008 at 12:58am
Hi,
Just tried and it works. You need compile application and run exe to see bitmaps. From IDE resources are not loaded.
 
For png use
IDB_TOOLBAR1     PNG    toolbar1.png
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
slvrbllt View Drop Down
Groupie
Groupie
Avatar

Joined: 16 September 2006
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote slvrbllt Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2008 at 4:50am
Thanks Oleg!
 
You are right! It works perfectly when compiled.
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.172 seconds.