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

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mksol!mavmav
  3. From: mavmav@mksol.dseg.ti.com (michael a vincze)
  4. Subject: Re: Loading Bitmaps from Resource Editor (TPW 1.5)
  5. Message-ID: <1993Jan7.002739.1790@mksol.dseg.ti.com>
  6. Sender: mavmav@mksol (michael a vincze)
  7. Nntp-Posting-Host: localhost
  8. Organization: Texas Instruments
  9. References:  <1993Jan6.205044.24863@news2.cis.umn.edu>
  10. Date: Thu, 7 Jan 1993 00:27:39 GMT
  11. Lines: 34
  12.  
  13. In article <1993Jan6.205044.24863@news2.cis.umn.edu>, you write:
  14. |> Hello,
  15. |> 
  16. |> I am writing a solitare type game and have a couple of questions about
  17. |> loading bitmaps from a *.res file.  I have been loading the bitmaps
  18. |> sequentially into a single variable of type HBitmap when the program
  19. |> needs to display them.  The problem is that I don't think that the
  20. |> HBitmap variable is being reused properly.  When I exit the application,
  21. |> a certain percentage of the windows resources reported by the Program
  22. |> Manager are gone.  What does the program need to do in order to reuse
  23. |> the variable?  When I use DeleteObject, the program crashes with a stack
  24. |> error.  Should I just load all of the bitmaps into an array?
  25. |> I am using TPW 1.5
  26. |> 
  27. |> Thanks in advance,
  28.  
  29.  
  30. I'm not sure if this going to work, however I have encountered the
  31. aforementioned crashes as well.
  32.  
  33. The problem is that you are trying to delete an object that has not been
  34. created.  In order to overcome this, in your Init constructor initialize all
  35. HBitmaps to nil (ie: QueenOfHearts := nil;.)  Then in your Done destructor test
  36. to see if the variable is nil, and if not then you know that you have
  37. created (allocated space for) that object (ie: if QueenOfHearts <> nil then
  38. DeleteObject (QueenOfHearts).)  Sorry if my syntax is incorrect.
  39.  
  40. Hope this helps.
  41.  
  42. Best regards,
  43. Mihcael Vincze
  44. ma@asd470.dseg.ti.com
  45.  
  46.  
  47.