Main form

Top  Previous  Next

DFM-Translator > Creating Forms dynamically > Main form

The first form automatically created with Application.CreateForm becomes the main form of the application. However, if the form is created dynamically with new and shown with ShowModal, it does not have this status. As a result, no icon is displayed in the taskbar for the application and it is no longer possible to switch back to the application once it has been minimized.

 

The read-only property Application.MainForm cannot be easily changed, but overriding the CreateParams function helps here. Since Delphi2Cpp translates Delphi files independently without project information, it does not know which form files are used as main forms. The CreateParams function is therefore only output as a comment. If a form is used as the main form, the comment characters have to be be removed manually.

 

 

  //# please uncomment for main form

  //# void __fastcall CreateParams(Vcl::Controls::TCreateParams &Params)

    //# {inherited::CreateParams(Params); Params.ExStyle = Params.ExStyle | WS_EX_APPWINDOW;}

 

->

 

void __fastcall CreateParams(Vcl::Controls::TCreateParams &Params)

  {inherited::CreateParams(Params); Params.ExStyle = Params.ExStyle | WS_EX_APPWINDOW;}

 

 

 

 

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content