 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Manu Guest
|
Posted: Thu May 27, 2004 3:43 pm Post subject: TMemoryStream, TImage - Windows Me,98,95 fatal system ressou |
|
|
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
|
Posted: Thu May 27, 2004 4:28 pm Post subject: Re: TMemoryStream, TImage - Windows Me,98,95 fatal system re |
|
|
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 |
|
 |
|
|
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
|
|