123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424 |
- /****************************************************************/
- /* */
- /* WizardPages.cpp */
- /* */
- /* Implementation of the New User Wizard. */
- /* */
- /* Programmed by LYFZ van der Meer */
- /* Copyright LYFZ Software Solutions 2002 */
- /* http://www.LYFZvandermeer.nl */
- /* */
- /* Last updated: 10 july 2002 */
- /* */
- /****************************************************************/
- #include "stdafx.h"
- #include "DBServer.h"
- #include "theDBServer.h"
- #include "WizardPages.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- IMPLEMENT_DYNAMIC(CWizardSheet, CPropertySheetEx)
- CWizardSheet::CWizardSheet(UINT nIDCaption, CWnd* pParentWnd,
- UINT iSelectPage, HBITMAP hbmWatermark, HPALETTE hpalWatermark,
- HBITMAP hbmHeader)
- : CPropertySheetEx(nIDCaption, pParentWnd, iSelectPage,
- hbmWatermark, hpalWatermark, hbmHeader)
- {
- // add all the pages of the wizard
- InitPages();
- // set the WIZARD97 flag so we'll get the new look
- m_psh.dwFlags |= PSH_WIZARD97;
- m_psh.dwFlags &= ~PSH_HASHELP;
- }
- CWizardSheet::CWizardSheet(LPCTSTR pszCaption, CWnd* pParentWnd,
- UINT iSelectPage, HBITMAP hbmWatermark, HPALETTE hpalWatermark,
- HBITMAP hbmHeader)
- : CPropertySheetEx(pszCaption, pParentWnd, iSelectPage,
- hbmWatermark, hpalWatermark, hbmHeader)
- {
- // add all the pages of the wizard
- InitPages();
- // set the WIZARD97 flag so we'll get the new look
- m_psh.dwFlags |= PSH_WIZARD97;
- m_psh.dwFlags &= ~PSH_HASHELP;
- }
- CWizardSheet::~CWizardSheet()
- {
- }
- BEGIN_MESSAGE_MAP(CWizardSheet, CPropertySheetEx)
- //{{AFX_MSG_MAP(CWizardSheet)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /********************************************************************/
- /* */
- /* Function name : InitPages */
- /* Description : Add pages to wizard. */
- /* */
- /********************************************************************/
- void CWizardSheet::InitPages()
- {
- AddPage(&m_Page1);
- AddPage(&m_Page2);
- AddPage(&m_Page3);
- AddPage(&m_Page4);
- AddPage(&m_PageFinish);
- }
- IMPLEMENT_DYNCREATE(CWizardPage1, CPropertyPageEx)
- CWizardPage1::CWizardPage1() : CPropertyPageEx(CWizardPage1::IDD, 0, IDS_HEADERTITLE1, NULL)
- {
- //{{AFX_DATA_INIT(CWizardPage1)
- m_strAccountName = _T("");
- //}}AFX_DATA_INIT
- m_psp.dwFlags &= ~PSP_HASHELP;
- }
- CWizardPage1::~CWizardPage1()
- {
- }
- void CWizardPage1::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPageEx::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CWizardPage1)
- DDX_Text(pDX, IDC_ACCOUNTNAME, m_strAccountName);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CWizardPage1, CPropertyPageEx)
- //{{AFX_MSG_MAP(CWizardPage1)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /********************************************************************/
- /* */
- /* Function name : OnSetActive */
- /* Description : Called when this becomes the active page. */
- /* */
- /********************************************************************/
- BOOL CWizardPage1::OnSetActive()
- {
- CPropertySheetEx* parent = (CPropertySheetEx*)GetParent();
- parent->SetWizardButtons(PSWIZB_NEXT);
- return CPropertyPageEx::OnSetActive();
- }
- /********************************************************************/
- /* */
- /* Function name : OnWizardNext */
- /* Description : Called when Next button has been pressed. */
- /* */
- /********************************************************************/
- LRESULT CWizardPage1::OnWizardNext()
- {
- CEdit *editBox = (CEdit *)GetDlgItem(IDC_ACCOUNTNAME);
- if (editBox->GetWindowTextLength() == 0)
- {
- MessageBox("You must enter an account name.", "Account Wizard", MB_OK | MB_ICONEXCLAMATION);
- editBox->SetFocus();
- return -1;
- }
- return CPropertyPageEx::OnWizardNext();
- }
- IMPLEMENT_DYNCREATE(CWizardPage2, CPropertyPageEx)
- CWizardPage2::CWizardPage2() : CPropertyPageEx(CWizardPage2::IDD, 0, IDS_HEADERTITLE2, NULL)
- {
- //{{AFX_DATA_INIT(CWizardPage2)
- m_strPassword = _T("");
- //}}AFX_DATA_INIT
- m_psp.dwFlags &= ~PSP_HASHELP;
- }
- CWizardPage2::~CWizardPage2()
- {
- }
- void CWizardPage2::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPageEx::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CWizardPage2)
- DDX_Text(pDX, IDC_PASSWORD, m_strPassword);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CWizardPage2, CPropertyPageEx)
- //{{AFX_MSG_MAP(CWizardPage2)
- // NOTE: the ClassWizard will add message map macros here
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /********************************************************************/
- /* */
- /* Function name : OnSetActive */
- /* Description : Called when this becomes the active page. */
- /* */
- /********************************************************************/
- BOOL CWizardPage2::OnSetActive()
- {
- CPropertySheetEx* parent = (CPropertySheetEx*)GetParent();
- parent->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
- return CPropertyPageEx::OnSetActive();
- }
- /********************************************************************/
- /* */
- /* Function name : OnWizardNext */
- /* Description : Called when Next button has been pressed. */
- /* */
- /********************************************************************/
- LRESULT CWizardPage2::OnWizardNext()
- {
- CString strPassword, strConfirmPassword;
- GetDlgItemText(IDC_PASSWORD, strPassword);
- GetDlgItemText(IDC_CONFIRMPASSWORD, strConfirmPassword);
- if (strPassword != strConfirmPassword)
- {
- MessageBox("The passwords do not match!\r\nPlease make sure 'Password' and 'Confirm Password' are the same.", "Connection Wizard", MB_OK | MB_ICONEXCLAMATION);
- GetDlgItem(IDC_PASSWORD)->SetFocus();
- return -1;
- }
- return CPropertyPageEx::OnWizardNext();
- }
- IMPLEMENT_DYNCREATE(CWizardPage3, CPropertyPageEx)
- CWizardPage3::CWizardPage3() : CPropertyPageEx(CWizardPage3::IDD, 0, IDS_HEADERTITLE3, NULL)
- {
- //{{AFX_DATA_INIT(CWizardPage3)
- m_strHomeDirectory = _T("");
- //}}AFX_DATA_INIT
- m_psp.dwFlags &= ~PSP_HASHELP;
- }
- CWizardPage3::~CWizardPage3()
- {
- }
- void CWizardPage3::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPageEx::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CWizardPage3)
- DDX_Text(pDX, IDC_HOMEDIRECTORY, m_strHomeDirectory);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CWizardPage3, CPropertyPageEx)
- //{{AFX_MSG_MAP(CWizardPage3)
- ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /********************************************************************/
- /* */
- /* Function name : OnSetActive */
- /* Description : Called when this becomes the active page. */
- /* */
- /********************************************************************/
- BOOL CWizardPage3::OnSetActive()
- {
- CPropertySheetEx* parent = (CPropertySheetEx*)GetParent();
- parent->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
- return CPropertyPageEx::OnSetActive();
- }
- /********************************************************************/
- /* */
- /* Function name : OnBrowse */
- /* Description : Browse for folder. */
- /* */
- /********************************************************************/
- void CWizardPage3::OnBrowse()
- {
- CString strDir = BrowseForFolder(m_hWnd, "Select a directory:", BIF_RETURNONLYFSDIRS);
- if (!strDir.IsEmpty())
- {
- GetDlgItem(IDC_HOMEDIRECTORY)->SetWindowText(strDir);
- }
- }
- /********************************************************************/
- /* */
- /* Function name : OnWizardNext */
- /* Description : Called when Next button has been pressed. */
- /* */
- /********************************************************************/
- LRESULT CWizardPage3::OnWizardNext()
- {
- CString strHomeDirectory;
- if (GetDlgItemText(IDC_HOMEDIRECTORY, strHomeDirectory) == 0)
- {
- MessageBox("You must specify a home directory.", "Account Wizard", MB_OK | MB_ICONEXCLAMATION);
- GetDlgItem(IDC_HOMEDIRECTORY)->SetFocus();
- return -1;
- }
- // check if it's a valid directory
- if (GetFileAttributes(strHomeDirectory) == 0xFFFFFFFF)
- {
- MessageBox("The directory you entered is not valid.", "Account Wizard", MB_OK | MB_ICONEXCLAMATION);
- GetDlgItem(IDC_HOMEDIRECTORY)->SetFocus();
- return -1;
- }
- return CPropertyPageEx::OnWizardNext();
- }
- IMPLEMENT_DYNCREATE(CWizardPage4, CPropertyPageEx)
- CWizardPage4::CWizardPage4() : CPropertyPageEx(CWizardPage4::IDD, 0, IDS_HEADERTITLE4, NULL)
- {
- //{{AFX_DATA_INIT(CWizardPage4)
- m_bAllowCreateDirectory = FALSE;
- m_bAllowDelete = FALSE;
- m_bAllowDownload = FALSE;
- m_bAllowRename = FALSE;
- m_bAllowUpload = FALSE;
- //}}AFX_DATA_INIT
- m_psp.dwFlags &= ~PSP_HASHELP;
- }
- CWizardPage4::~CWizardPage4()
- {
- }
- void CWizardPage4::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPageEx::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CWizardPage4)
- DDX_Check(pDX, IDC_CREATE_DIR, m_bAllowCreateDirectory);
- DDX_Check(pDX, IDC_DELETE, m_bAllowDelete);
- DDX_Check(pDX, IDC_DOWNLOAD, m_bAllowDownload);
- DDX_Check(pDX, IDC_RENAME, m_bAllowRename);
- DDX_Check(pDX, IDC_UPLOAD, m_bAllowUpload);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CWizardPage4, CPropertyPageEx)
- //{{AFX_MSG_MAP(CWizardPage4)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /********************************************************************/
- /* */
- /* Function name : OnInitDialog */
- /* Description : Initialize dialog. */
- /* */
- /********************************************************************/
- BOOL CWizardPage4::OnInitDialog()
- {
- CPropertyPageEx::OnInitDialog();
-
- return TRUE;
- }
- /********************************************************************/
- /* */
- /* Function name : OnSetActive */
- /* Description : Called when this becomes the active page. */
- /* */
- /********************************************************************/
- BOOL CWizardPage4::OnSetActive()
- {
- CPropertySheetEx* parent = (CPropertySheetEx*)GetParent();
- parent->SetWizardButtons( PSWIZB_BACK | PSWIZB_NEXT);
- return CPropertyPageEx::OnSetActive();
- }
- IMPLEMENT_DYNCREATE(CWizardFinish, CPropertyPageEx)
- CWizardFinish::CWizardFinish() : CPropertyPageEx(CWizardFinish::IDD)
- {
- //{{AFX_DATA_INIT(CWizardFinish)
- //}}AFX_DATA_INIT
- m_psp.dwFlags |= PSP_HIDEHEADER;
- m_psp.dwFlags &= ~PSP_HASHELP;
- }
- CWizardFinish::~CWizardFinish()
- {
- }
- void CWizardFinish::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPageEx::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CWizardFinish)
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CWizardFinish, CPropertyPageEx)
- //{{AFX_MSG_MAP(CWizardFinish)
- ON_BN_CLICKED(IDC_CONNECTNOW, OnConnectnow)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /********************************************************************/
- /* */
- /* Function name : OnSetActive */
- /* Description : Called when this becomes the active page. */
- /* */
- /********************************************************************/
- BOOL CWizardFinish::OnSetActive()
- {
- CPropertySheetEx* parent = (CPropertySheetEx*)GetParent();
- parent->SetWizardButtons( PSWIZB_BACK | PSWIZB_NEXT | PSWIZB_FINISH);
- return CPropertyPageEx::OnSetActive();
- }
- /********************************************************************/
- /* */
- /* Function name : OnConnectnow */
- /* Description : */
- /* */
- /********************************************************************/
- void CWizardFinish::OnConnectnow()
- {
- UpdateData();
- }
|