home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!nott!emr1!jagrant
- From: jagrant@emr1.emr.ca (John Grant)
- Subject: Re: Loading Bitmaps from Resource Editor (TPW 1.5)
- Message-ID: <1993Jan6.222118.29376@emr1.emr.ca>
- Organization: Energy, Mines, and Resources, Ottawa
- References: <1993Jan6.205044.24863@news2.cis.umn.edu>
- Date: Wed, 6 Jan 1993 22:21:18 GMT
- Lines: 28
-
- In article <1993Jan6.205044.24863@news2.cis.umn.edu> erik@turtle.psych.umn.edu (Erik Arthur) writes:
- >Hello,
- >
- >I am writing a solitare type game and have a couple of questions about
- >loading bitmaps from a *.res file. I have been loading the bitmaps
- >sequentially into a single variable of type HBitmap when the program
- >needs to display them. The problem is that I don't think that the
- >HBitmap variable is being reused properly. When I exit the application,
- >a certain percentage of the windows resources reported by the Program
- >Manager are gone. What does the program need to do in order to reuse
- >the variable? When I use DeleteObject, the program crashes with a stack
- >error. Should I just load all of the bitmaps into an array?
- >I am using TPW 1.5
- You *must* ensure that you have de-selected the object *before*
- you delete it.
-
- HBITMAP old_hbitmap,hbitmap;
- hbitmap=....this is the bitmap you have loaded
- old_hbitmap=SelectObject(hdc,hbitmap);
- ...
- SelectObject(hdc,old_hbitmap);
- DeleteObject(hbitmap);
-
- If you are already doing that, then I have no other ideas.
- --
- John A. Grant jagrant@emr1.emr.ca
- Airborne Geophysics
- Geological Survey of Canada, Ottawa
-