In the FireMonkey application, forms are automatically created (created), and the MainForm property MainForm assigned in the Application.Run method. Thus, the access violation is caused by the fact that the MainForm property and form1 are nil.
To access these properties, you must first run the RealCreateForms method
begin Application.Initialize; Application.CreateForm(TForm2, Form1); Application.RealCreateForms; //Application.MainForm.Left:=-Application.MainForm.Width; Application.MainForm.Visible:=False; Application.Run; end.
source share