BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TMemoryStream, TImage - Windows Me,98,95 fatal system ressou

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Manu
Guest





PostPosted: Thu May 27, 2004 3:43 pm    Post subject: TMemoryStream, TImage - Windows Me,98,95 fatal system ressou Reply with quote




Hi,

I need help because my program have some bugs on windows me and minor version.
On Xp and 2000 that's ok.

I try to load bitmap with code below,

TMemoryStream * stream = new TMemoryStream();
DWORD len;
// ...bmpdata contains bitmap file bytes
// ...bmpsize contains bitmap file length in bytes
// ...pImage is (TImage *)
if (stream)
{
len = stream->Write(bmpdata, bmpsize);
stream->Position = 0;
pImage->Picture->Bitmap->LoadFromStream(stream);
stream->Position = 0;
stream->Clear();
delete(stream);
}

It's ok but when i use this a lot, i have a fatal system error and system freeze.
Systems ressources going down to 0% in one call of this code.

Anyone Can help me???

Thanks.
Back to top
Damon Chandler (TeamB)
Guest





PostPosted: Thu May 27, 2004 4:28 pm    Post subject: Re: TMemoryStream, TImage - Windows Me,98,95 fatal system re Reply with quote



Hi,
What size and format bitmaps are you working with? If you're bitmaps
are large, I can see how you might run out of resources because before
you call the TMemoryStream::Clear() method, you essentially have three
copies of the bitmap data (one in bmpdata, one in the TMemoryStream, and
one held in the TImage's Bitmap). You might try freeing bmpdata after
you write it to the stream, and perhaps use a TFileStream instead of a
TMemoryStream. Also, the format of the bitmap is important because the
TBitmap class will actually create a device-dependent bitmap (DDB) for
some bitmap flavors. Creating many and or a large DDB will quickly
comsume GDI resources, especially on Win9x/ME-based systems. The other
variety of bitmaps that the TBitmap class will create is a DIB section
bitmap; these also have size/quantity limitations, so if you're images
are extremely large, you'll need to store the image data in a raw
format--e.g., a DIB--and then create a DDB or DIB section for one bitmap
at a time, or for a chunk of a bitmap at a time.

HTH,
--
Damon (TeamB)


Manu wrote:
Quote:
I need help because my program have some bugs on windows me and minor version.
On Xp and 2000 that's ok.
pImage->Picture->Bitmap->LoadFromStream(stream);
It's ok but when i use this a lot, i have a fatal system error and system freeze.
Systems ressources going down to 0% in one call of this code.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.