Loading Bitmaps from Resource Editor (TPW 1.5)

Loading Bitmaps from Resource Editor (TPW 1.5)

Post by Erik Arth » Fri, 08 Jan 1993 05:50:44



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,


 
 
 

Loading Bitmaps from Resource Editor (TPW 1.5)

Post by John Gra » Fri, 08 Jan 1993 07:21:18



>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.
--

Airborne Geophysics
Geological Survey of Canada, Ottawa

 
 
 

Loading Bitmaps from Resource Editor (TPW 1.5)

Post by michael a vinc » Fri, 08 Jan 1993 09:27:39



|> 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

 
 
 

1. Help: Loading 256 color bitmap in MSVC 1.5

I need to load a 256 color bitmap into a form as a background. If I use
Import fuction in AppStudio, it seems to me that I can only load 16 color
bitmap. But I really need 256 color at least.

Any help out there?

Thank you in advance.

Harry


2. FW: Ordering output variables........????

3. Using TPW, how do I load dialog box resources from DLLs?

4. error BC30002

5. Calling NotifyRegister in TPW 1.5

6. Hierarchy of storage for Jornada 568

7. How to write a Keyboard.dll with TPW 1.5

8. Great news... concerning Atari

9. Good book for TPW 1.5 anyone?

10. How to spool doc in TPW 1.5

11. How to use the CTL3D.DLL with TPW 1.5?

12. How to set AbortProc in TPW 1.5?

13. >>TPW 1.5: Waiting 2 seconds