Quote
Stefan Cruysberghs <stefa...@yucom.be> wrote in message
3b2714f7$1_1@dnews...
Quote
> Hello
> It seams that Picto, my glyphs, icons and resource bitmap viewer, writing
in Delphi, crashes on Win95 and Win98 PC's. I have found that when the GDI
and User resources become lower then 10%, the program isn't stable anymore.
This can cause strange errors like 'This parameter is incorrect', 'Bitmap
image
Quote
> is not valid', 'Canvas does not allow'. On WinNT/2000 PC's the program
stays stable even working with it for many hours.
Quote
> I known that there is a limit on resources in Win95/98. I also found some
routines using GetFreeSystemResources, QT_Thunk (from USER.EXE and
KERNEL32.DLL) to get the free resources on Win95/98. It seams that there are
no routines to get this information on WinNT/2000 ?
Quote
> My program uses 3 internal TBitmaps and 1 TIcon which are created when
starting and freed when closing the program. For caching all images in the
selected file, I use a TList with bitmaps. These bitmaps are freed and the
list is cleared when selecting another file. The program uses a lot of
Quote
> Assign methods to copy the temporary results to each other (converting,
resizing, ...) . I tried some things by freeing and creating the all bitmaps
again, using the bitmap methods dormant and freeimage, ... Nothing seams to
solve the problem.
Quote
> The GDI and User resources are continuously decreasing when showing images
in other directories. The memory (checked in windows taskmanager) just
increases some kb after working for a while. So I do'nt thing there is a
serious memory leak.
Quote
> Where can I find more information about this issue ? Is there a way to
release all resources ?
Quote
> All information and ideas are welcome
> Stefan
> http://www.stefancr.yucom.be
I suspect you are creating lots of offscreen bitmaps to display the icons :
Does your program have the same purpose of ACDsee that creates thumbnails in
a given folder ? If so , you shouldn't create all the thumbnails at a time
but only those that have to be displayed :
Besides this you could have also some resource leak somewhere :
however you should be very carefully and follow the following tips when
working with bitmaps :
1) Always remember to free a bitmap when you create it .
2) I would avoid using assign between bitmaps : this command is unsafe if
you don't use it properly : instead use the bitmap.canvas.draw method to
copy between bitmaps : i very rarely use assign method it can causes a lot
of problems because it doesn't create a new bitmap but creates a link
between bitmaps variables to the same memory content .
3) Don't create many bitmaps : if you have to store the thumbnails somewhere
then i would use tmemorystream ( this is limited only by the memory of your
pc and not by the windows system and gdi resources ) .
4) To store the thumbnails you could use also a filestream : somewhere on
the net there are delphi examples about it : Personally i use a database to
store the thumbs in my program .
5) On Windows 95/98 do not create bitmaps larger than 2500x2500x24bit
pixelformat : this limit can be higher or lower depending on the video
device : however the limit generally is not higher than 3000x3000x24bit
pixels bitmaps on w95/98 .