![]() |
Load PNGs from Resource DLL |
Post Reply ![]() |
Author | |
slvrbllt ![]() Groupie ![]() ![]() Joined: 16 September 2006 Status: Offline Points: 14 |
![]() ![]() ![]() ![]() ![]() 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.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
How did you use LoadBitmapFromResource ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
slvrbllt ![]() Groupie ![]() ![]() Joined: 16 September 2006 Status: Offline Points: 14 |
![]() ![]() ![]() ![]() ![]() |
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 ?
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
slvrbllt ![]() Groupie ![]() ![]() Joined: 16 September 2006 Status: Offline Points: 14 |
![]() ![]() ![]() ![]() ![]() |
Thanks Oleg!
You are right! It works perfectly when compiled.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |