Print Page | Close Window

Load PNGs from Resource DLL

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=10281
Printed Date: 08 October 2024 at 1:30am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Load PNGs from Resource DLL
Posted By: slvrbllt
Subject: Load PNGs from Resource DLL
Date 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.



Replies:
Posted By: Oleg
Date Posted: 17 April 2008 at 1:21pm
Hi,
How did you use LoadBitmapFromResource  ?


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


Posted By: slvrbllt
Date 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 ?


Posted By: Oleg
Date 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


Posted By: slvrbllt
Date Posted: 18 April 2008 at 4:50am
Thanks Oleg!
 
You are right! It works perfectly when compiled.



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