Loading Icons From a Resource File |
Post Reply |
Author | |
mzwandile
Newbie Joined: 16 August 2012 Location: South Africa Status: Offline Points: 6 |
Post Options
Thanks(0)
Posted: 28 September 2012 at 10:12am |
Hi
I am using Xtreme Command Bars ActiveX v15.2.1 and need assistance with loading icons from a resource file (VB6 .RES file). I've got a PNG image with ID: "Exit16_PNG" in the resource file (filename.RES) and I'm doing the following in my VB6 Code to load the image:
CommandBars.Icons.LoadBitmapFromResource App.hInstance, "Exit16_PNG", ID_FILE_EXIT, xtpImageNormal
This does not load the icon though! Am I missing something?
Any assistance will be much appreciated.
|
|
Mzwandile Jojisa
Software developer Sage Alchemex |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Could be a number of things without seeing your complete code or how you made the RES.
First in the VB IDE (see add-in manager if not visible) open VB Resource Editor, verify your PNG images have the "PNG" type. If you were to add a new PNG you would click Add Custom Resource and in Resource type write "PNG" after you have selected the image. Second, app.hinstance just returns a handle to the instance of the application. You need to use LoadLibraryEx. Here is a working sample assuming your RES file is set up correctly like I mentioned above.
|
|
iamgtd
Senior Member Joined: 25 February 2009 Status: Offline Points: 131 |
Post Options
Thanks(0)
|
How does it work in C#.NET?
Public Sub LoadIconFromResource( _
ByVal Module As Long, _
ByVal Resource As Long, _
ByVal Command As Long, _
ByVal imageState As XTPImageState _
) Is there another way to get the value for Module as the API-Function LoadLibraryEx?In C# the images in the resources have names (string) and not long-values, how do I convert this values? thanks in advance |
|
---------
OS: Win 10 64 bit Codejock Version 22.1 ActiveX MS Visual Studio 2022 - C# --------- |
|
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 |