-
Load an API Image list from a Strip Bitmap in a resource file
I am trying to use the ImageList_LoadImage api function to Load a image list
from a strip bitmap that is in my resource file.
I use the following code:
'***************************************************************
Declare Function ImageList_LoadImage Lib "COMCTL32" Alias
"ImageList_LoadImageA" (ByVal hi As Long, ByVal lpbmp As String, ByVal cx As
Long, ByVal cGrow As Long, ByVal crMask As Long, ByVal uType As Long, ByVal
uFlags As Long) As Long
m_himl = ImageList_LoadImage(App.hInstance, CStr("#101"), 16, -1, RGB(0,
128, 128), IMAGE_BITMAP, 0&)
'***************************************************************
What am I missing this seems like it should work!!!
Help
Scott
-
Re: Load an API Image list from a Strip Bitmap in a resource file
Ok I figured out that if I compile the program to an EXE the code works
fine.
Is there a way to make the code work correctly in the IDE?
This would be kind of a pain to have to compile to see the images correctly.
TIA
Scott
Scott Stanaland <stanland@bellsouth.net> wrote in message
news:39352937$1@news.devx.com...
> I am trying to use the ImageList_LoadImage api function to Load a image
list
> from a strip bitmap that is in my resource file.
>
> I use the following code:
>
> '***************************************************************
>
> Declare Function ImageList_LoadImage Lib "COMCTL32" Alias
> "ImageList_LoadImageA" (ByVal hi As Long, ByVal lpbmp As String, ByVal cx
As
> Long, ByVal cGrow As Long, ByVal crMask As Long, ByVal uType As Long,
ByVal
> uFlags As Long) As Long
>
> m_himl = ImageList_LoadImage(App.hInstance, CStr("#101"), 16, -1, RGB(0,
> 128, 128), IMAGE_BITMAP, 0&)
>
> '***************************************************************
>
> What am I missing this seems like it should work!!!
>
> Help
>
> Scott
>
>
>
-
Re: Load an API Image list from a Strip Bitmap in a resource file
Ok I figured out that if I compile the program to an EXE the code works
fine.
Is there a way to make the code work correctly in the IDE?
This would be kind of a pain to have to compile to see the images correctly.
TIA
Scott
Scott Stanaland <stanland@bellsouth.net> wrote in message
news:39352937$1@news.devx.com...
> I am trying to use the ImageList_LoadImage api function to Load a image
list
> from a strip bitmap that is in my resource file.
>
> I use the following code:
>
> '***************************************************************
>
> Declare Function ImageList_LoadImage Lib "COMCTL32" Alias
> "ImageList_LoadImageA" (ByVal hi As Long, ByVal lpbmp As String, ByVal cx
As
> Long, ByVal cGrow As Long, ByVal crMask As Long, ByVal uType As Long,
ByVal
> uFlags As Long) As Long
>
> m_himl = ImageList_LoadImage(App.hInstance, CStr("#101"), 16, -1, RGB(0,
> 128, 128), IMAGE_BITMAP, 0&)
>
> '***************************************************************
>
> What am I missing this seems like it should work!!!
>
> Help
>
> Scott
>
>
>
-
Re: Load an API Image list from a Strip Bitmap in a resource file
Scott,
>I am trying to use the ImageList_LoadImage api function to Load a image list
>from a strip bitmap that is in my resource file.
Are you running in the IDE or compiled code? APIs dealing with
resources wont work in the IDE, because App.hInstance points to the
VB6.EXE instead of your app. When you compile the code it should work.
Another thing you could try is to change the declare to
...., ByVal lpbmp As Long, ...
and call it with ImageList_LoadImage(..., 101, ...)
Not that it should matter, but you never know :-)
One last thing. I see you're passing -1 as the cGrow parameter. I
can't see anything in the docs about using -1 there. So why do you do
that, and have you tried changing it to xero or some positive value?
Mattias
____________________________________________
Mattias Sjögren - mattiass @ hem.passagen.se
http://hem.spray.se/mattias.sjogren/
-
Re: Load an API Image list from a Strip Bitmap in a resource file
Scott,
>I am trying to use the ImageList_LoadImage api function to Load a image list
>from a strip bitmap that is in my resource file.
Are you running in the IDE or compiled code? APIs dealing with
resources wont work in the IDE, because App.hInstance points to the
VB6.EXE instead of your app. When you compile the code it should work.
Another thing you could try is to change the declare to
...., ByVal lpbmp As Long, ...
and call it with ImageList_LoadImage(..., 101, ...)
Not that it should matter, but you never know :-)
One last thing. I see you're passing -1 as the cGrow parameter. I
can't see anything in the docs about using -1 there. So why do you do
that, and have you tried changing it to xero or some positive value?
Mattias
____________________________________________
Mattias Sjögren - mattiass @ hem.passagen.se
http://hem.spray.se/mattias.sjogren/
-
Re: Load an API Image list from a Strip Bitmap in a resource file
Scott,
>Is there a way to make the code work correctly in the IDE?
Probably not using ImageList_LoadImage. But you could use VBs
LoadResPicture function (which does work in the IDE), and then put the
returned bitmap in an ImageList using ImageList_AddMasked.
The code would look something like this (not tested though):
m_himl = ImageList_Create(...)
Call ImageList_AddMasked(m_himl, LoadResPicture(101,
vbResBitmap).Handle, RGB(0, 128, 128))
Mattias
____________________________________________
Mattias Sjögren - mattiass @ hem.passagen.se
-
Re: Load an API Image list from a Strip Bitmap in a resource file
Scott,
>Is there a way to make the code work correctly in the IDE?
Probably not using ImageList_LoadImage. But you could use VBs
LoadResPicture function (which does work in the IDE), and then put the
returned bitmap in an ImageList using ImageList_AddMasked.
The code would look something like this (not tested though):
m_himl = ImageList_Create(...)
Call ImageList_AddMasked(m_himl, LoadResPicture(101,
vbResBitmap).Handle, RGB(0, 128, 128))
Mattias
____________________________________________
Mattias Sjögren - mattiass @ hem.passagen.se
-
Re: Load an API Image list from a Strip Bitmap in a resource file
Mattias
The ImageList_AddMasked Funtion worked well!
Thanks alot for the help!!
Scott
Mattias Sjögren <mattiass.dont.want.spam@hem.passagen.se> wrote in message
news:39353034.3403814@news.devx.com...
> Scott,
>
> >Is there a way to make the code work correctly in the IDE?
>
> Probably not using ImageList_LoadImage. But you could use VBs
> LoadResPicture function (which does work in the IDE), and then put the
> returned bitmap in an ImageList using ImageList_AddMasked.
>
> The code would look something like this (not tested though):
>
> m_himl = ImageList_Create(...)
> Call ImageList_AddMasked(m_himl, LoadResPicture(101,
> vbResBitmap).Handle, RGB(0, 128, 128))
>
>
> Mattias
>
> ____________________________________________
> Mattias Sjögren - mattiass @ hem.passagen.se
-
Re: Load an API Image list from a Strip Bitmap in a resource file
Mattias
The ImageList_AddMasked Funtion worked well!
Thanks alot for the help!!
Scott
Mattias Sjögren <mattiass.dont.want.spam@hem.passagen.se> wrote in message
news:39353034.3403814@news.devx.com...
> Scott,
>
> >Is there a way to make the code work correctly in the IDE?
>
> Probably not using ImageList_LoadImage. But you could use VBs
> LoadResPicture function (which does work in the IDE), and then put the
> returned bitmap in an ImageList using ImageList_AddMasked.
>
> The code would look something like this (not tested though):
>
> m_himl = ImageList_Create(...)
> Call ImageList_AddMasked(m_himl, LoadResPicture(101,
> vbResBitmap).Handle, RGB(0, 128, 128))
>
>
> Mattias
>
> ____________________________________________
> Mattias Sjögren - mattiass @ hem.passagen.se
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks