Home All Groups Group Topic Archive Search About
Author
12 Oct 2005 8:05 AM
davids
Using the following function call to load a bitmap but I get error 1814 - The
specified resource name cannot be found in the image file.

GetBitmap = LoadImage(0, "mybitmap.bmp", _
                IMAGE_BITMAP, 16, 16, _
                LR_LOADFROMFILE Or LR_LOADMAP3DCOLORS)

How can I get this to work?

Author
12 Oct 2005 9:50 AM
Mike D Sutton
> Using the following function call to load a bitmap but I get error 1814 -
> The
> specified resource name cannot be found in the image file.
>
> GetBitmap = LoadImage(0, "mybitmap.bmp", _
>                IMAGE_BITMAP, 16, 16, _
>                LR_LOADFROMFILE Or LR_LOADMAP3DCOLORS)
>
> How can I get this to work?

Try specifying the full path to the file, also the LR_LOADMAP3DCOLORS flag
will only work on paletted images however this should just be ignored on
higher bit-depth images.
Hope this helps,

    Mike


- Microsoft Visual Basic MVP -
E-Mail: ED***@mvps.org
WWW: Http://EDais.mvps.org/
Author
12 Oct 2005 11:42 AM
J French
On Wed, 12 Oct 2005 01:05:01 -0700, =?Utf-8?B?ZGF2aWRz?=
<dav***@discussions.microsoft.com> wrote:

>Using the following function call to load a bitmap but I get error 1814 - The
>specified resource name cannot be found in the image file.
>
>GetBitmap = LoadImage(0, "mybitmap.bmp", _
>                IMAGE_BITMAP, 16, 16, _
>                LR_LOADFROMFILE Or LR_LOADMAP3DCOLORS)
>
>How can I get this to work?

Post the Declaration - maybe that is wrong
Author
14 Oct 2005 4:11 AM
davids
Using declaration
Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal
hInst As Long, ByVal lpsz As String, ByVal iType As Long, ByVal cx As Long,
ByVal cy As Long, ByVal fOptions As Long) As Long

Have removed the parameter LR_LOADMAP3DCOLORS from my function call.
Have changed the filename to the full pathname.
Still the same error!

Application I am developing calls for a returned HBITMAP of a 16X16 bitmap
so I believe that LoadImage is the best man for the job.

Show quoteHide quote
"J French" wrote:

> On Wed, 12 Oct 2005 01:05:01 -0700, =?Utf-8?B?ZGF2aWRz?=
> <dav***@discussions.microsoft.com> wrote:
>
> >Using the following function call to load a bitmap but I get error 1814 - The
> >specified resource name cannot be found in the image file.
> >
> >GetBitmap = LoadImage(0, "mybitmap.bmp", _
> >                IMAGE_BITMAP, 16, 16, _
> >                LR_LOADFROMFILE Or LR_LOADMAP3DCOLORS)
> >
> >How can I get this to work?
>
> Post the Declaration - maybe that is wrong
>
>
>
Author
14 Oct 2005 4:24 AM
davids
Worked out that the constants used in my function call were not defined.
(:<|)

Show quoteHide quote
"davids" wrote:

> Using declaration
> Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal
> hInst As Long, ByVal lpsz As String, ByVal iType As Long, ByVal cx As Long,
> ByVal cy As Long, ByVal fOptions As Long) As Long
>
> Have removed the parameter LR_LOADMAP3DCOLORS from my function call.
> Have changed the filename to the full pathname.
> Still the same error!
>
> Application I am developing calls for a returned HBITMAP of a 16X16 bitmap
> so I believe that LoadImage is the best man for the job.
>
> "J French" wrote:
>
> > On Wed, 12 Oct 2005 01:05:01 -0700, =?Utf-8?B?ZGF2aWRz?=
> > <dav***@discussions.microsoft.com> wrote:
> >
> > >Using the following function call to load a bitmap but I get error 1814 - The
> > >specified resource name cannot be found in the image file.
> > >
> > >GetBitmap = LoadImage(0, "mybitmap.bmp", _
> > >                IMAGE_BITMAP, 16, 16, _
> > >                LR_LOADFROMFILE Or LR_LOADMAP3DCOLORS)
> > >
> > >How can I get this to work?
> >
> > Post the Declaration - maybe that is wrong
> >
> >
> >
Author
14 Oct 2005 9:00 AM
J French
On Thu, 13 Oct 2005 21:24:36 -0700, =?Utf-8?B?ZGF2aWRz?=
<dav***@discussions.microsoft.com> wrote:

>Worked out that the constants used in my function call were not defined.
>(:<|)

Put this at the top of EVERY module

Option Explicit : DefObj A-Z

You'll be amazed at what it flushes out