Monday, March 31, 2014

[C++ Builder] Show a form before Mainform is shown

[Reference]
http://embarcadero.newsgroups.archived.at/public.delphi.vcl.components.using/200904/0904161856.html

Sometimes, an application requires to show a form before the Mainform. This following code shows how to create and show a form (DialogSelectLanguage) before Mainform (FornMain) is show.

Notice: DialogSelectLanguage should be moved to < Avaliable forms > ( [Project] [Options...] [Form] )



int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int) 

  Application->Initialize(); 
  
// Create a form before Mainform is creacted.
  DialogSelectLanguage = new TDialogSelectLanguage(Application);   // Show the form
  DialogSelectLanguage->ShowModal(); 
  ... 
  ... 
  DialogSelectLanguage->Release(); // If needed
  DialogSelectLanguage=NULL; 

  // Create Mainform  Application->CreateForm(__classid(TFormMain), &FormMain); 
  Application->Run(); 
  return 0;  
}



No comments:

Post a Comment

[Qt] 執行檔需要哪些 Dll?

 1. 使用 Qt  的 windeployqt.exe 工具 (在 C:\Qt\Qt5.14.1\5.14.1\msvc2017\bin\)。   a. 把執行檔 myProgram.exe 放在某個資料夾。   b. 在檔案總管這個資料夾按 Shift 和滑鼠右鍵,開啟 Po...