[comp.windows.ms.programmer] Bitmaps

jaz@icd.ab.com (Jack A. Zucker) (06/26/91)

I am using LoadBitmap(hInstance,"bitmapname"); to load bitmap resources.
I am trying to do this in the WM_CREATE: case of a child window. I get
a NULL back from the function. When I move the LoadBitmap up to the
parent's WM_CREATE: it works fine. I've tried setting the segment
attributes to preload nondiscardable but to no avail.

| Jack A Zucker         {cwjcc,pyramid,decvax,uunet}!jaz@icd.ab.com |
| Allen-Bradley Company, Inc. or                     ICCGCC::ZUCKER |
| 747 Alpha Drive                                                   |
| Highland Hts., OH 44143 Phone(216) 646-4668   FAX: (216) 646-4484 | 

jaz@icd.ab.com (Jack A. Zucker) (06/26/91)

In article <1991Jun25.182619.150@icd.ab.com>, jaz@icd.ab.com (Jack A.
Zucker) writes:
|> I am using LoadBitmap(hInstance,"bitmapname"); to load bitmap resources.
|> I am trying to do this in the WM_CREATE: case of a child window. I get
|> a NULL back from the function. When I move the LoadBitmap up to the
|> parent's WM_CREATE: it works fine. I've tried setting the segment
|> attributes to preload nondiscardable but to no avail.
|> 


I since changed my program to load the bitmaps from a DLL. It still has
the same symptoms. To load the DLL I use:

hLibrary = LoadLibrary("d:\\windev\\jaz\\palette\\bitmap.dll");

To load the bitmap I say:

hBitmap = LoadBitmap(hLibrary,"Pencil"); /* where pencil is the resource */

Once again, The LoadLibrary() and LoadBitmap() only work when done in
the parent window. When called from the child's WM_CREATE: they return
NULL. 

Unfortunately this is not mentioned in any of the SDK documentation, nor
is it mentioned in Petzold's book. Am I doing something dumb or is this
just a poorly documented feature ?

| Jack A Zucker         {cwjcc,pyramid,decvax,uunet}!jaz@icd.ab.com |
| Allen-Bradley Company, Inc. or                     ICCGCC::ZUCKER |
| 747 Alpha Drive                                                   |
| Highland Hts., OH 44143 Phone(216) 646-4668   FAX: (216) 646-4484 |