🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #2535

Re: Loading Bitmaps from Resource Editor (TPW 1.5)

#2535
From: michael a vincze
Date: Thu, 07 Jan 1993 00:27
32 lines
1951 bytes
In article <1993Jan6.205044.24863@news2.cis.umn.edu>, you write:
|> 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
|> 
|> Thanks in advance,


I'm not sure if this going to work, however I have encountered the
aforementioned crashes as well.

The problem is that you are trying to delete an object that has not been
created.  In order to overcome this, in your Init constructor initialize all
HBitmaps to nil (ie: QueenOfHearts := nil;.)  Then in your Done destructor test
to see if the variable is nil, and if not then you know that you have
created (allocated space for) that object (ie: if QueenOfHearts <> nil then
DeleteObject (QueenOfHearts).)  Sorry if my syntax is incorrect.

Hope this helps.

Best regards,
Mihcael Vincze
ma@asd470.dseg.ti.com
Technical Details
Message-ID: <1993Jan7.002739.1790@mksol.dseg.ti.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mksol!mavmav
References: <1993Jan6.205044.24863@news2.cis.umn.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mksol!mavmav
From: mavmav@mksol.dseg.ti.com (michael a vincze)
Subject: Re: Loading Bitmaps from Resource Editor (TPW 1.5)
Message-ID: <1993Jan7.002739.1790@mksol.dseg.ti.com>
Sender: mavmav@mksol (michael a vincze)
Nntp-Posting-Host: localhost
Organization: Texas Instruments
References:  <1993Jan6.205044.24863@news2.cis.umn.edu>
Date: Thu, 7 Jan 1993 00:27:39 GMT
Lines: 34