Bug? EReadError, Glyphs, multiple OSes, D1, D2, D3

I recently developed a multimedia application that used the TBitButton for all my buttons on a Delphi 1.0 application. The intent was to have the program run under Win3.X. I now have an Error that reads
"Exception EReadError in module CDMASTER.EXE at xxxxxx
Error reading play.Glyph.Data: Out of System Resources"

I have surfed the WWW for information on what is causing this error and have found that no one seems to know. I have seen references to this error on two other shareware product WWW pages and have seen numerous posts to various
"Delphi" newsgroups that show other persons are having these same problem. This error seems to appear on any Delphi product under any operating system; However, this error is sometimes reported to be a small percentage of people. In my program, it happens to every Win3.X user.

Perhaps someone has solved this problem? Perhaps someone would be kind enough to post some workarounds or solutions for this problem. If you think you know the problem, add a comment... This problem is big enough that any little bit will help.

Perhaps it is a bug that has gone unfixed in all versions?


Note: I will not grade a question until I have verfied the fix.

Looking forward to a great discussion!
John Zitterkopf
zittAsked:
Who is Participating?
 
interConnect With a Mentor Commented:
Dear zitt,

You may lower the points and spend less if you want, because I can not find the answer! So please do what you want, I am ok.

Thanks
Igor
0
 
interCommented:
dear zitt,

We have discussed the out of system resources problem in a previous problem with 'oris' This means the FREE handles of the system are about to be exausted. I wrote here what I have suggested. By using less handles he can be able to solve the problem.

Causes
------
EOutofResources error is reported by the Windows whenever a handle is to be created or new class is to be registered to the system. Any handle creation function (DC, menu,window-form) returns 0 and Delphi interpret this as a OutofResources error.
By my opinion this is not correct, or one step more is needed to understand the actual error.The delphi should call GetLastError, but it does not.
When I search this error in VCL source code I found that it is in the following units: Graphics, Forms, Menus.

Limits
------
Windows 95 is limitted to 16384 handles per object class, i.e. this much of menu or window locks up the system. However Windows NT does not have a restriction on number of handles (It said to be so). And as far as I know for win3.1 the limit is 65536 system wide.

Suggestions
-----------
Asside from the other friends suggestions I have the following:
1 - If you are creating several TCanvas, TPen, TBrush, TMetafile etc.(in general memory consuming GDI objects), be sure to call Free for them.
2 - As a rule of thumb do not precreate more than 20 such resources on FormCreate.
3 - Remember that out of resources error is cummulative. i.e. it may not appear at the begining; by forgetting to release handles the system resources may be used up gradualy.
4 - If you sure that you free the handles allocated by your program (manualy by calling constructors of TCanvas, TPen etc), try to maintain the list of handles manualy created by
program and FREE them ALL in ExitProc or finalization section. Because when your program terminated erronously some of the Free methods may not be called
5 - If you are making use of large bitmaps just for painting the background of forms etc. Create bitmap, paint it and release it if you are not doing time critical painting (animation).

What do you think friend?

Igor
0
 
zittAuthor Commented:
Igor,

Thanks for your comments. Good ones, however, my error isn't EOutofResources it's EReadError. The error occurs when the forms are being created, not during normal execution of the program.
I'm not manually creating any resources, only using TBitButtons.

John
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
interCommented:
Yes, however, if the error (if we examine the source -delphi 1.0 client server-) the error is realated with windows handles. By thinking of Win31, the possible cause can be

- There may not be either enough ! FILE HANDLES !
  or ! GDI HANDLES !

Could I express myself friend,
please comment
Igor
0
 
ZifNabCommented:
Have you compiled the RES file with BRCC (for 16 bit!) or with BRCC32 (for 32 bit)
0
 
zittAuthor Commented:
Inter,

Ah... yes, good point. I'll suggest filehandles as a possible fix.

ZifNab,
The .RES files were generated with ImageEditor that comes with Delphi 1.0.

John
0
 
zittAuthor Commented:
Found the problem...

Turns out that some of the glyphs I had loaded in my TBitBtns were truecolor (24bit) BMPs. It turns out that Delphi/Win3.x cannot handle 24bit BMPs unless the video resolution is capable of displaying 24bit graphics.

I'm happy I found the problem with the help Synature. Now... If I can just recover the 2mths I spent attempting to fix the problem.

Inter... I'll give you the points for the question since you put the most time into it... just give a quick answer and I'll give you a grade.

John
0
 
zittAuthor Commented:
You cannot lower points for a question only raise. I tried 8)

I hope this helps other persons!
0
 
interCommented:
Dear zitt

308 is realy much, tell me something and I cooperate with you, a custom component? a component modification or enhancement? anything? Please just tell...

Sincerely
Igor
0
 
zittAuthor Commented:
Igor,

Really, it's OK. As long as someone benfits from my 2mth struggle with this bug, I think 308 points is worth it.

As far a componets, I have one that could be modified... but I'm not sure it's an easy mod... (If it were, I'd have already done it).
Whatever the case, Just enjoy the points... they were free to me... now they're free for you.
0
 
interCommented:

I got it. Thanks.

Igor
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.