It's easy enough to work this out from the code. You just do a text search for TApplication.Create
. For example using the IDE's Find in Files feature.
But you can always be lazy and get the debugger to do it.
- Enable Debug DCUs.
- Set a breakpoint in
TApplication.Create
.
- Run.
When the program breaks, look at the call stack. You will see that the TApplication
object is instantiated from InitControls
in the Controls
unit. And InitControls
is called from the initialization
section of the Controls
unit.
The full call stack for a plain vanilla VCL app looks like this:
Vcl.Forms.TApplication.Create(nil)
Vcl.Controls.InitControls
Vcl.Controls.Vcl.Controls
System.InitUnits
System._StartExe(???,???)
SysInit._InitExe($5A81BC)
Project1.Project1
:749933aa kernel32.BaseThreadInitThunk + 0x12
:76f09ef2 ntdll.RtlInitializeExceptionChain + 0x63
:76f09ec5 ntdll.RtlInitializeExceptionChain + 0x36
Doing the same thing with TScreen.Create
, you will see that the TScreen
object is also instantiated in InitControls()
.
I won't try and explain all of this. I think there's enough information and advice here for you to work it all out from here. Although this is the call stack from an XE3 application, it will look just the same for your Delphi 5 application.