I am new to VC++. I use VC++6 and use MFC.
I assume that the 1st dialog is in class CPassDlg.
I assume that the 2nd dialog is in class CWorkDlg.
I also assume that the Edit control does not use a database for storing a password and is named IDC_EDIT_PASS.
I also assume that there is a button on the CPassDlg that verifies the password when clicked named IDC_BTN_PASS.
1. Open the class wizard ( Ctrl+W ).
2. Select CpassDlg.
3. Select tab "Member Variables".
4. Select the control. i.e. IDC_EDIT_PASS
5. Click "Add Variable".
6. In the following dialog, enter the following parameters:
Control ID = IDC_EDIT_PASS
Variable Name = m_editPass
Category = Control
Type = CEdit
7. Use class wizard to add member function that handles BN_CLICKED message for the IDC_BTN_PASS.
8. Name the function "OnBtnPass".
9. Use class wizard to similarly create an OnOK function for your OK button.
10. Go to the function OnBtnPass in your Dialog's Implimentation file and add:
void CPassDlg::OnBtnPass()
{
CString szPassword = "Your Password goes here";
CString szUser;
// This retrieves the value in the Edit Control to a CString variable
m_editPass.GetWindowText( szUser );
if( szUser == szPassword )
{
CWorkDlg dlg; // Creates the new dialog
dlg.DoModal(); // Executes it in Modal format
OnOK(); // Activates the OK button, closing the dialog
}
else
{
AfxMessageBox( "Wrong Password Sherlock Holmes!!" );
}
}
11. Compile and run the program.
I have not tested this. So sorry for any error or bugs.

Take it Easy

Kartik.S