Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it ok to create an object before Application.Initialize?

Is it ok to create an object (my own class) before Application.Initialize?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Is it ok to create an object (my own class) before Application.Initialize?

Certainly. You can do anything you like in your program (*.dpr file).

In fact, you may have been doing this already, without knowing it. If you have ever used the initialization section of a unit — or a modern class constructor — you have executed your own code prior to Application.Initialize.

Writing custom code at this early time of your program’s lifetime is neither unusual nor bad practice.

But you should be extra careful, of course, because the pre-Application.Run environment is subtly different from the Application.Run environment. For instance, an unhandled exception will kill your app.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading