WEBINAR:

On-Demand

Error Creating Window

Question: In my Delphi 1.0 application, when I open a form (e.g. ClientForm.Show) I get an error message: "Error creating window." This error occurs when several forms (nine or ten forms that manage Paradox tables) were previously "showed" then "closed." An EOutofMemory exception is raised, but doing a MemAvail shows that 16 MB still remains in heap. I don't know what the problem is.

Answer: Make sure that in the OnClose event of each of your forms, you put the following line:

Action := caFree;

This will make sure that the resources used by the form are freed up at close.

Also, check to see if your code opens up stuff like tables or queries without freeing them. For data access objects that are dropped on a form, they'll get destroyed with the form. But if you're creating tables or queries on the fly, then you have to explicitly free them.