The errors are completely random in nature, sometimes at launch of app.
or after the app. has ran for hours or days or never at all. Also each
build of the app. seems to produce a different pattern of errors (hard
to detect due to the random nature).
The reason for my post is in the latest build I can almost consistently
reproduce the error on my development machine. We have a ViewRegister
object that our "Views" (form units) use to register themselves during
unit initialization. When a "View" is added to the ViewRegister a TIcon
objects is created to hold the icon for the "View". The error occurs
when the "desktop" is creating a TImageList using the icons stored in
the ViewRegister.
ImageList.AddIcon(ViewRegister[i].IconImage) ends up calling
TIcon.HandleNeeded which calls function ReadIcon which calls CreateIcon
which is an API call (code is in Graphics.pas). CreateIcon returns a
0 so the VCL calls function GDIError. Now get this! If I put a break
point on Icon := CreateIcon(...) in function ReadIcon and pause for
several seconds the error NEVER happens! Without a break point the error
happens about 72% of the time. What is happening that would cause Win XP
to recover it's self by forcing a pause?
Now for my question. Is this a VCL/OS flavor problem? Is there some type
of bad code (improper type casting, etc) that could cause CreateIcon to
fail? All along we've suspected our code but when I found that a pause
causes the problem to resolve its' self I am now wondering about the VLC/OS.
Any insight into the internal working of the VCL and windows resources
would be appreciated. Any pointers on how to nail this one down?
Terrence Koehn
Orion Law Management Systems
"Terrence Koehn" <tko...@orionlaw.com> wrote in message
news:42b074ee$1...@newsgroups.borland.com...
<snip>
Unfortanatly with todays build I no longer can reproduce the error. As I
stated it is a moving target.
"Terrence Koehn" <tko...@orionlaw.com> wrote in message
news:42b1a842$1...@newsgroups.borland.com...
I think GDI is global resource.
That's to say, if both of your app and all other apps running in the system
use too much GDI resource, maybe it will exceed the system limitation.
1, To reproduct that error, try to open as many big apps as you can, eg,
open several MS office, Delphi, etc, then run your app again.
2, "pause" problem maybe caused the system has freed some resouce
when you paused your app?
3, How big is your app? More than 1M source code lines?
If you app is too big, you should be careful to free unnecessary resouce
and re-create it when need. eg. don't create About dialog at startup,
only create it when the user click menu 'About'. :-)
4, There are always kinds of limitations in the OS, no matter it's 98 or XP.
So I think such error is most like caused by your own design.
Have you done some memory/resource leak test? If you haven't, do it now.