home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4660 < prev    next >
Encoding:
Text File  |  1993-01-06  |  1.6 KB  |  39 lines

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