 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
martin Guest
|
Posted: Wed Mar 02, 2005 3:10 pm Post subject: can you help with windows resources please ? |
|
|
my application uses a large number of graphics files opened and closed
but may need many open at once. The heap monitor procedure seems to be
useless for this purpose as far as I can tell.
I dont appear to have memory leaks as far as I can see but I am
running into problems of identifying when windows resources are low.
I read somewhere there was a way to get an idea of what resources are
left but that it wasnt easy. does anyone know how ?
I think I could be runing out of handles or GDI resourcesa or something
but cant work out what.
Is there a component or something I can use to just warn me when
resources are getting low because normal exceptions just dont work.
Using D5 Enterprise and Win-98 but also need the answer for Win2K and XP
Martin
----------------------
----------------------
|
|
| Back to top |
|
 |
Peter Below (TeamB) Guest
|
Posted: Wed Mar 02, 2005 7:06 pm Post subject: Re: can you help with windows resources please ? |
|
|
In article <MPG.1c8fe7a08bddf47b9896b5 (AT) newsgroups (DOT) borland.com>, Martin
wrote:
| Quote: | my application uses a large number of graphics files opened and closed
but may need many open at once. The heap monitor procedure seems to be
useless for this purpose as far as I can tell.
I dont appear to have memory leaks as far as I can see but I am
running into problems of identifying when windows resources are low.
I read somewhere there was a way to get an idea of what resources are
left but that it wasnt easy. does anyone know how ?
|
Unit Sysresources;
Interface
Uses Windows, Sysutils;
const
GFSR_SYSTEMRESOURCES = 0;
GFSR_GDIRESOURCES = 1;
GFSR_USERRESOURCES = 2;
Function GetSystemResources( typ: Word ): Integer;
Implementation
Var
hDll: HMODULE;
pProc: Function (typ:word):Integer stdcall;
Function GetSystemResources( typ:word ): Integer;
begin
result := pProc( typ );
end;
Function InternalGetSystemresources( typ: Word ): Integer; stdcall;
Begin
result := -1;
End;
Initialization
pProc := InternalGetSystemresources;
If Win32Platform <>VER_PLATFORM_WIN32_NT Then Begin
hdll:= LoadLibrary( 'rsrc32.dll' );
if hdll <> 0 then begin
@pProc := getProcAddress( hdll, '_MyGetFreeSystemResources32@4' );
if @pProc = nil then
pProc := InternalGetSystemresources;
end
end;
Finalization
If hDLL <> 0 Then
FreeLibrary( hdll );
End.
| Quote: | Using D5 Enterprise and Win-98 but also need the answer for Win2K and XP
|
Win2K and XP do not have this problem.
--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
|
|
| Back to top |
|
 |
GrandmasterB Guest
|
Posted: Wed Mar 02, 2005 9:25 pm Post subject: Re: can you help with windows resources please ? |
|
|
| Quote: | I dont appear to have memory leaks as far as I can see but I am
running into problems of identifying when windows resources are low.
|
What you may want to look at doing is storing your graphics in memory
streams, rather than carrying around a great many bitmap handles. I had the
same problem in an app. Under 98, things seemed to max out after about 200
TBitmaps were created.
Basically, create a tmemory stream, and load the file. When you need to
draw it, create a tbitmap, load it from the stream, draw, and then delete
the bmp.
Also, if you have a lot of forms set to autocreate, create them manually
instead. That cuts down a lot on resource usage.
|
|
| Back to top |
|
 |
martin Guest
|
Posted: Thu Mar 03, 2005 8:38 pm Post subject: Re: can you help with windows resources please ? |
|
|
In article <VA.0000b8d7.004889d3 (AT) nomail (DOT) please>,
[email]100113.1101 (AT) compuXXserve (DOT) com[/email] says...
| Quote: | In article <MPG.1c8fe7a08bddf47b9896b5 (AT) newsgroups (DOT) borland.com>, Mart
Unit Sysresources;
Interface
Uses Windows, Sysutils;
....
|
Thanks Peter that looks very useful I'll give it a go
Martin
-------------------------------
-------------------------------
|
|
| 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
|
|