|  | 
| Load PNGs from Resource DLL | 
| Post Reply   | 
| Author | |
| slvrbllt   Groupie     Joined: 16 September 2006 Status: Offline Points: 14 |  Post Options  Thanks(0)  Quote  Reply  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. | |
|  | |
| Oleg   Senior Member   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |  Post Options  Thanks(0)  Quote  Reply  Posted: 17 April 2008 at 1:21pm | 
| 
   Hi,
 How did you use LoadBitmapFromResource  ? | |
| 
     Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS | |
|  | |
| slvrbllt   Groupie     Joined: 16 September 2006 Status: Offline Points: 14 |  Post Options  Thanks(0)  Quote  Reply  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 ? | |
|  | |
| Oleg   Senior Member   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |  Post Options  Thanks(0)  Quote  Reply  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 | |
|  | |
| slvrbllt   Groupie     Joined: 16 September 2006 Status: Offline Points: 14 |  Post Options  Thanks(0)  Quote  Reply  Posted: 18 April 2008 at 4:50am | 
| 
   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 |