Re: How to load bitmaps from a resource file?
- From: "MikeD" <nobody@xxxxxxxxxxx>
- Date: Fri, 19 May 2006 17:50:43 -0400
"Geo" <Geo@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:A6114740-4F16-482A-B209-8A028943F89A@xxxxxxxxxxxxxxxx
Hi to all,
I created a resource file in Visual C++ 6.0 that contains 3 bitmaps. It is
compiled and included in a Visual Basic 6.0 project. I can see the resource
file under the "Related Documents" of my project in the Project Group window.
I'm trying to populate an ImageCombo with these bitmaps. For this, I created
an ImageList control and I'm trying to fill it with these bitmaps by doing:
For index = 1 To 3
sImage = GetImage(index)
imgList.ListImages.add(, , LoadResPicture(sImage, vbResBitmap))
Next
Function GetImage(index As Integer) As String
Dim sImage As String
Select Case index
Case 1
sImage = "IDB_CIRCLE" 'The ID of the bitmap resource in VC++
Case 2
sImage = "IDB_SQUARE" 'The ID of the bitmap resource in VC++
Case 3
sImage = "IDB_TRIANGLE" 'The ID of the bitmap resource in VC++
End Select
GetImage = sImage
End Function
Please note that my code worked fine when I was loading the bitmaps from a
hard-coded path (instead of trying to load them from the resource file) using:
LoadPicture(sPath + sImage + sExt) 'sExt = ".bmp"
When you created the resource file, did you actually use strings for the indexes? Are those IDB_ strings actually supposed to be constants for numeric values? Have you tried creating your resource file using VB's Resource Editor AddIn?
--
Mike
Microsoft MVP Visual Basic
.
- Prev by Date: Re: XP Styles in VB6 using version 6 of common controls
- Next by Date: Draw line across controls
- Previous by thread: Shell Change Notification on Networked Drive
- Next by thread: Draw line across controls
- Index(es):
Relevant Pages
|