Board index » cppbuilder » Main Form hiding
Alexandru Dragusanu
![]() CBuilder Developer |
Alexandru Dragusanu
![]() CBuilder Developer |
Main Form hiding2005-10-07 06:00:22 PM cppbuilder42 How can I make an app that, when it starts, keeps the main form hidden and shows another form (like a login form)?? |
Hans Galema
![]() CBuilder Developer |
2005-10-07 06:14:40 PM
Re:Main Form hiding
Alexandru Dragusanu wrote:
QuoteHow can I make an app that, when it starts, keeps the main form hidden and WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { Application->Initialize(); TLoginForm *LoginForm = new TLoginForm ( Application ); LoginForm->Show(); while ( ! LoginForm->ready ) // public: bool ready; Application->ProcessMessages(); bool ok = LoginForm->ok; // public: bool ok; delete LoginForm; //well you could have used a modal form too I think if ( ok ) Application->CreateForm(__classid(TMainForm), &MainForm); Application->Run(); } catch (Exception &exception) { Application->ShowException(&exception); } return 0; } Hans. |
Alexandru Dragusanu
![]() CBuilder Developer |
2005-10-07 11:07:05 PM
Re:Main Form hiding
I had some troubles with this method, but I found in C++'s Help a very easy
way to do this: 1)set MainForm's Visible propriety to false 2)set LoginForm's Visible propriety to true 3)before Application->Run(); write Application->ShowMainForm=false; The MainForm is now hidden when the app starts. :) "Hans Galema" < XXXX@XXXXX.COM >wrote in message QuoteAlexandru Dragusanu wrote: {smallsort} |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2005-10-08 04:26:04 AM
Re:Main Form hiding
"Hans Galema" < XXXX@XXXXX.COM >wrote in message
QuoteLoginForm->Show(); Since you are deleting the form once it becomes 'ready', then the form can simply close itself by setting its ModalResult property when needed. ShowModal() returns the value of the ModalResult property. Quoteif ( ok ) { Application->CreateForm(__classid(TMainForm), &MainForm); Application->Run(); } Gambit |