Im creating an add-in using VB.NET (VS2008) for an application that has a COM interface, referenced via interops.
I have added a toolbar to the application which is functioning correctly, but I cant find a way of getting bitmaps to display on the buttons. The buttons are simply black squares!
When I created an add-in for this same application in VB6, this was not a problem. Using the resource editor, I was able to create toolbar images that resided in addin.res which was then compiled into the dll. The images displayed correctly on the buttons.
The code in VB6 looked like this:
Object.SetAddInInfo(InstanceHandle, EnvironmentCatID, CategoryName, IDColorBitmapMedium, IDColorBitmapLarge, IDMonochromeBitmapMedium, IDMonochromeBitmapLarge, NumberOfCommands, CommandNames, CommandIDs)
ObjectRequired. The object to which the method applies.
InstanceHandleRequired Long.
EnvironmentCatIDRequired String. Specifies the ID of the environment to which the command bar button is to be added.
CategoryNameRequired String.
IDColorBitmapMediumRequired Long.
IDColorBitmapLargeRequired Long.
IDMonochromeBitmapMediumRequired Long.
IDMonochromeBitmapLargeRequired Long.
NumberOfCommandsRequired Long.
CommandNamesRequired Array of Strings.
CommandIDsRequired Array of Longs.
In VB.NET I can get the instance handle of my dll like this...
Dim aModule As System.Reflection.Module = Me.GetType().Module
Dim aModuleInstance as integer = Marshal.GetHINSTANCE(aModule).ToInt32
The difficulty I now have is trying to add a bitmap resource to my project that can then be passed to the addin via the longs in the SetAddInInfo method.
Is there any way to achieve this in .NET?