OWL question: display a login dialog box before main window shows

OWL question: display a login dialog box before main window shows

Post by WAN » Fri, 06 Jan 1995 05:55:21



Hi, everyone, I need your help now.

I am writing a program with login check. What I really want is to present
a welcome box first with User_ID and User_Password input and then jump
to the main window after user passes the login check.

Following is the code I wrote so far in Borland's OWL, which always
generates the main window first and then displays a welcome box.  I know
by executing TApplication::InitInstance() will display the main window.
Now my question is how to display a dialog box before the main window is
shown up on the screen? Displaying a dialog box needs a window's handle,
so before the main window is created, how do I handle the dialog box?

Thanks in advances!

Webb

------------------------------------------------------------------------
void myApp::InitInstance ()
{
        TApplication::InitInstance();
        if (TWelcomeDlg(GetMainWindow(), Transfer).Execute() ==
                 IDOK)
        {
                string info;
                info += Transfer.UserID;
                info += "\n";
                info += Transfer.UserPassword;
                info += "\n";

                Transfer.UserID[0]=0;
                Transfer.UserPassword[0]=0;

                GetMainWindow()->MessageBox(info.c_str(),
                                            "Login Results", MB_OK);
        }
        else
                GetMainWindow()->CloseWindow();

Quote:}

--------------------------------------------------------------------------
 
 
 

OWL question: display a login dialog box before main window shows

Post by Michael Sawcz » Fri, 06 Jan 1995 11:13:26



Quote:

>Hi, everyone, I need your help now.

>I am writing a program with login check. What I really want is to present
>a welcome box first with User_ID and User_Password input and then jump
>to the main window after user passes the login check.

Create the dialog in the MainWindow's SetupWindow(). You'll have a parent
HWindow (the MainWindow's) and, if the login fails, simply call CloseWindow().
That'll end the app.

--
===============================================================
Michael Sawczyn                      Don'chu worry, never fear,


              Just who IS Heywood Banks, anyway?
===============================================================

 
 
 

OWL question: display a login dialog box before main window shows

Post by Kent To » Sun, 08 Jan 1995 07:42:31


|> Hi, everyone, I need your help now.
|>
|> I am writing a program with login check. What I really want is to present
|> a welcome box first with User_ID and User_Password input and then jump
|> to the main window after user passes the login check.
|>
|> Following is the code I wrote so far in Borland's OWL, which always
|> generates the main window first and then displays a welcome box.  I know
|> by executing TApplication::InitInstance() will display the main window.
|> Now my question is how to display a dialog box before the main window is
|> shown up on the screen? Displaying a dialog box needs a window's handle,
|> so before the main window is created, how do I handle the dialog box?

You should not call TApplication::InitInstance() anymore. You can copy
the source of it and rearrange the position of the call
MainWindow->ShowWindow(). Or simply roll your own:

void myApp::InitInstance ()
{
   InitMainWindow();

   MainWindow->Create();

   if (TWelcomeDlg(GetMainWindow(), Transfer).Execute() == IDOK)
   {
        string info;
        info += Transfer.UserID;
        ...
        MainWindow->ShowWindow();
        MainWindow->Update();
   }
   else
   {
        GetMainWindow()->Destroy();
   }

Quote:}

|> ------------------------------------------------------------------------
|> void myApp::InitInstance ()
|> {
|>   TApplication::InitInstance();
|>   if (TWelcomeDlg(GetMainWindow(), Transfer).Execute() ==
|>            IDOK)
|>   {
|>           string info;
|>           info += Transfer.UserID;
|>           info += "\n";
|>           info += Transfer.UserPassword;
|>           info += "\n";
|>
|>           Transfer.UserID[0]=0;
|>           Transfer.UserPassword[0]=0;
|>
|>           GetMainWindow()->MessageBox(info.c_str(),
|>                                             "Login Results", MB_OK);
|>   }
|>   else
|>           GetMainWindow()->CloseWindow();
|> }
|> --------------------------------------------------------------------------

--

Freeman Installer (WWW)--->http://www.arch.su.edu.au/~tongk/0.html
Freeman Installer (ftp)--->ftp.arch.su.edu.au   /pub/tongk/finst152.zip
Key Center of Design Computing, Sydney University

 
 
 

OWL question: display a login dialog box before main window shows

Post by Mitchel Dui » Thu, 12 Jan 1995 03:58:53


Why should he not call the base classes InitInstance?  I thought all of
the functions that are overridden should call the base classes mehtod ..
like setupwindow, evsize, etc ..

Mitch

: You should not call TApplication::InitInstance() anymore. You can copy
: the source of it and rearrange the position of the call
: MainWindow->ShowWindow(). Or simply roll your own:

: void myApp::InitInstance ()
: {
:    InitMainWindow();
:    
:    MainWindow->Create();
:    
:    if (TWelcomeDlg(GetMainWindow(), Transfer).Execute() == IDOK)
:    {
:       string info;
:       info += Transfer.UserID;
:       ...
:       MainWindow->ShowWindow();
:       MainWindow->Update();
:    }
:    else
:    {
:       GetMainWindow()->Destroy();
:    }
: }

: |> ------------------------------------------------------------------------
: |> void myApp::InitInstance ()
: |> {
: |>         TApplication::InitInstance();
: |>         if (TWelcomeDlg(GetMainWindow(), Transfer).Execute() ==
: |>                  IDOK)
: |>         {
: |>                 string info;
: |>                 info += Transfer.UserID;
: |>                 info += "\n";
: |>                 info += Transfer.UserPassword;
: |>                 info += "\n";
: |>
: |>                 Transfer.UserID[0]=0;
: |>                 Transfer.UserPassword[0]=0;
: |>
: |>                 GetMainWindow()->MessageBox(info.c_str(),
: |>                                             "Login Results", MB_OK);
: |>         }
: |>         else
: |>                 GetMainWindow()->CloseWindow();
: |> }
: |> --------------------------------------------------------------------------

: --

: Freeman Installer (WWW)--->http://www.arch.su.edu.au/~tongk/0.html
: Freeman Installer (ftp)--->ftp.arch.su.edu.au   /pub/tongk/finst152.zip
: Key Center of Design Computing, Sydney University

 
 
 

1. Need help displaying a dialog box before main window is displayed

 I need her with a dialog bix I want to display before a user sees a main
window. I want the user to enter a name and a password before they can access
a program. I am using Borland C++ 4.0 and I would appreciate it if someone can
please e-mail me with help on how to diplay this dialog box and retrieve data
from it. I've managed to diaplay the dialog box which is begin called in
the InitMainWindow() function of my application derived from TApplication(), but
when I click on "OK", my program locks up. i don't understand. I tried to
override the CmOK() function provided by the TDialog class, but my program locks
up. I really need this feature in my program as it will also help me with other
parts of my program that I am working on. Thanks. I can be e-mailed at


TK

2. much to sell: blizzard 2060, 2k towers, etc...

3. How to not show main app window and shoe modelss dialog boxes

4. vax programming

5. BC++ 4.51 OWL vs Auto Radio Buttons in Main Window Dialog Boxes

6. help with configuring dhcp server

7. OWL: How to put data in combo box on Main Window Dialog?

8. Active Directory and PPTP in a single box

9. newbie question: dialog box as main window

10. BC4++ Question - Dialog boxes as main window

11. BC4++ Question - Dialog boxes as main window?

12. Dialog box as main window, how to in Windows 3.1?

13. Displaying a second DIALOG BOX from another DIALOG BOX????