Article View: comp.windows.ms.programmer
Article #1863Re: LoadBitmap help resummarization of help needed
From: Russ Poffenberger
Date: Wed, 27 Mar 1991 16:51
Date: Wed, 27 Mar 1991 16:51
45 lines
2461 bytes
2461 bytes
In article <27570@uflorida.cis.ufl.EDU> jdb@reef.cis.ufl.edu (Brian K. W. Hook) writes:
>In article <bjs4g8ti2@cctb.wa.com> curt@cctb.wa.com (Curt Johnson) writes:
>|>In article <27518@uflorida.cis.ufl.EDU> jdb@reef.cis.ufl.edu (Brian K. W. Hook) writes:
>|>Program dies during:
>|>| hBitMap=LoadBitmap(hInst,"boom");
>|>
>|>
>|>| 2. For some reason, substituting in a standard Windows bitmap and using:
>|>|
>|>| hBitMap=LoadBitmap(NULL,"OLD_BITMAP"); // OLD_BITMAP for demonstrative
>|>| // purposes
>|>Shouldn't that be:
>|> hBitMap=LoadBitmap(NULL,IDI_APPLICATION); //no quotes for standard Windows bitmaps
>
>Actually, you're right....but I changed it to without quotes a while ago
>and got it flagged as being an unknown identifier....and yes, I have
>inclued WINDOWS.H...:-)
>
[stuff deleted]
Here is a fragment of my code that works. If yours is similar, can't
understand why it doesn't work. Possibly you have corrupted resources or
memory like deleting stock objects, or not deleting objects when done, or
some such. Windows is quite picky about these things..
HBITMAP sbitmap,oldbitmap;
HDC hMemoryDC;
hMemoryDC = CreateCompatibleDC(hdc);
sbitmap = LoadBitmap(hinst,"saver");
oldbitmap = SelectObject(hMemoryDC,sbitmap);
BitBlt(hdc,border_x + 3 + SQ_SIZE_X * logo_x,
border_y + 3 + SQ_SIZE_Y * logo_y,
32,32,hMemoryDC,0,0,SRCCOPY);
SelectObject(hMemoryDC,oldbitmap);
DeleteObject(sbitmap);
DeleteDC(hMemoryDC);
Notice how old objects are saved, restored, and unused objects are then
deleted. This is VERY important.
Russ Poffenberger DOMAIN: poffen@sj.ate.slb.com
Schlumberger Technologies UUCP: {uunet,decwrl,amdahl}!sjsca4!poffen
1601 Technology Drive CIS: 72401,276
San Jose, Ca. 95110 (408)437-5254
Technical Details
Message-ID:
<1991Mar27.165111.1038@sj.ate.slb.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!sjsca4!poffenReferences:
<1991Mar19.103524.8474@cs.ubc.ca> <27518@uflorida.cis.ufl.EDU> <bjs4g8ti2@cctb.wa.com> <27570@uflorida.cis.ufl.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!sjsca4!poffen From: poffen@sj.ate.slb.com (Russ Poffenberger) Newsgroups: comp.windows.ms.programmer Subject: Re: LoadBitmap help resummarization of help needed Message-ID: <1991Mar27.165111.1038@sj.ate.slb.com> Date: 27 Mar 91 16:51:11 GMT References: <1991Mar19.103524.8474@cs.ubc.ca> <27518@uflorida.cis.ufl.EDU> <bjs4g8ti2@cctb.wa.com> <27570@uflorida.cis.ufl.EDU> Reply-To: poffen@SunOS (Russ Poffenberger) Organization: Schlumberger Technologies, ATE division, San Jose, Ca. Lines: 45