home *** CD-ROM | disk | FTP | other *** search
- // MyPropertyPage1.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "resource.h"
- #include "PPage1.h"
- #include "Wiz95Dlg.h"
- #include "Wizard95.h"
- #include "PSheet.h"
-
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- IMPLEMENT_DYNCREATE(CMyPropertyPage1, CPropertyPage)
- IMPLEMENT_DYNCREATE(CMyPropertyPage2, CPropertyPage)
- IMPLEMENT_DYNCREATE(CMyPropertyPage3, CPropertyPage)
- IMPLEMENT_DYNCREATE(CMyPropertyPage4, CPropertyPage)
- IMPLEMENT_DYNCREATE(CMyPropertyPage5, CPropertyPage)
-
-
- extern CWizard95App theApp;
- /////////////////////////////////////////////////////////////////////////////
- // CMyPropertyPage1 property page
-
- CMyPropertyPage1::CMyPropertyPage1() : CPropertyPage(CMyPropertyPage1::IDD)
- {
- //{{AFX_DATA_INIT(CMyPropertyPage1)
- m_MailSystem = -1;
- //}}AFX_DATA_INIT
- }
-
- CMyPropertyPage1::~CMyPropertyPage1()
- {
- }
-
- void CMyPropertyPage1::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMyPropertyPage1)
- DDX_Radio(pDX, IDC_CCMAIL, m_MailSystem);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CMyPropertyPage1, CPropertyPage)
- //{{AFX_MSG_MAP(CMyPropertyPage1)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CMyPropertyPage2 property page
-
- CMyPropertyPage2::CMyPropertyPage2() : CPropertyPage(CMyPropertyPage2::IDD)
- {
- //{{AFX_DATA_INIT(CMyPropertyPage2)
- m_Name = _T("");
- m_Password = _T("");
- //}}AFX_DATA_INIT
- }
-
- CMyPropertyPage2::~CMyPropertyPage2()
- {
- }
-
- void CMyPropertyPage2::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMyPropertyPage2)
- DDX_Text(pDX, IDC_NAME, m_Name);
- DDX_Text(pDX, IDC_PASSWORD, m_Password);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CMyPropertyPage2, CPropertyPage)
- //{{AFX_MSG_MAP(CMyPropertyPage2)
- // NOTE: the ClassWizard will add message map macros here
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CMyPropertyPage3 property page
-
- CMyPropertyPage3::CMyPropertyPage3() : CPropertyPage(CMyPropertyPage3::IDD)
- {
- //{{AFX_DATA_INIT(CMyPropertyPage3)
- m_TotalNum = _T("");
- //}}AFX_DATA_INIT
- m_InboxMsg=FALSE;
- }
-
- CMyPropertyPage3::~CMyPropertyPage3()
- {
- }
-
- void CMyPropertyPage3::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMyPropertyPage3)
- DDX_Control(pDX, IDC_LIST1, m_List);
- DDX_Text(pDX, IDC_NUM, m_TotalNum);
- DDV_MaxChars(pDX, m_TotalNum, 5);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CMyPropertyPage3, CPropertyPage)
- //{{AFX_MSG_MAP(CMyPropertyPage3)
- ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CMyPropertyPage4 property page
-
- CMyPropertyPage4::CMyPropertyPage4() : CPropertyPage(CMyPropertyPage4::IDD)
- {
- //{{AFX_DATA_INIT(CMyPropertyPage4)
- m_szNotePart = _T("");
- m_szSubject = _T("");
- m_szFrom = _T("");
- //}}AFX_DATA_INIT
- }
-
- CMyPropertyPage4::~CMyPropertyPage4()
- {
- }
-
- void CMyPropertyPage4::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMyPropertyPage4)
- DDX_Control(pDX, IDC_REPLY, m_Reply);
- DDX_Control(pDX, IDC_FORWARD, m_Forward);
- DDX_Text(pDX, IDC_NOTEPART, m_szNotePart);
- DDX_Text(pDX, IDC_SUBJECT, m_szSubject);
- DDX_Text(pDX, IDC_FROM, m_szFrom);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CMyPropertyPage4, CPropertyPage)
- //{{AFX_MSG_MAP(CMyPropertyPage4)
- ON_BN_CLICKED(IDC_SEND, OnSend)
- ON_BN_CLICKED(IDC_REPLY, OnReply)
- ON_BN_CLICKED(IDC_FORWARD, OnForward)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CMyPropertyPage5 property page
-
- CMyPropertyPage5::CMyPropertyPage5() : CPropertyPage(CMyPropertyPage5::IDD)
- {
- //{{AFX_DATA_INIT(CMyPropertyPage5)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
-
- CMyPropertyPage5::~CMyPropertyPage5()
- {
- }
-
- void CMyPropertyPage5::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMyPropertyPage5)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CMyPropertyPage5, CPropertyPage)
- //{{AFX_MSG_MAP(CMyPropertyPage5)
- // NOTE: the ClassWizard will add message map macros here
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
-
- BOOL CMyPropertyPage1::OnInitDialog()
- {
- CPropertyPage::OnInitDialog();
-
- // TODO: Add extra initialization here
- m_MailSystem=0;
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
-
- BOOL CMyPropertyPage1::OnSetActive()
- {
- // TODO: Add your specialized code here and/or call the base class
- CPropertySheet *pSheet=(CPropertySheet *) GetParent();
- pSheet->SetWizardButtons(PSWIZB_NEXT);
- return CPropertyPage::OnSetActive();
- }
-
- LRESULT CMyPropertyPage1::OnWizardNext()
- {
- // TODO: Add your specialized code here and/or call the base class
- UpdateData();
- switch (m_MailSystem)
- {
- case 0:
- theApp.m_pDlg->m_Session.SetMail_Type(2);
- break;
- case 1:
- theApp.m_pDlg->m_Session.SetMail_Type(1);
- break;
- case 2:
- theApp.m_pDlg->m_Session.SetMail_Type(3);
- break;
- }
-
- if (theApp.m_pDlg->m_Session.GetErrorNum()!=0) return -1;
-
- return CPropertyPage::OnWizardNext();
- }
-
- BOOL CMyPropertyPage2::OnSetActive()
- {
- // TODO: Add your specialized code here and/or call the base class
- CPropertySheet *pSheet=(CPropertySheet *) GetParent();
- pSheet->SetWizardButtons(PSWIZB_NEXT|PSWIZB_BACK);
- return CPropertyPage::OnSetActive();
- }
-
- LRESULT CMyPropertyPage2::OnWizardNext()
- {
- // TODO: Add your specialized code here and/or call the base class
- UpdateData();
- theApp.m_pDlg->m_Session.SetUser(m_Name);
- theApp.m_pDlg->m_Session.SetPassword(m_Password);
- theApp.m_pDlg->m_Session.SetLogon(TRUE);
-
- if (theApp.m_pDlg->m_Session.GetErrorNum()!=0 ||
- theApp.m_pDlg->m_Session.GetLogon()!=TRUE) return -1;
-
- return CPropertyPage::OnWizardNext();
- }
-
- LRESULT CMyPropertyPage3::OnWizardNext()
- {
- // TODO: Add your specialized code here and/or call the base class
- return CPropertyPage::OnWizardNext();
- }
-
- BOOL CMyPropertyPage3::OnSetActive()
- {
- // TODO: Add your specialized code here and/or call the base class
- CMyPropertySheet *pSheet=(CMyPropertySheet *) GetParent();
- pSheet->SetWizardButtons(PSWIZB_NEXT|PSWIZB_BACK);
- /* Try TO re-scan your Inbox!!*/
-
- BeginWaitCursor();
- m_List.SetRedraw(FALSE);
- m_List.DeleteAllItems();
-
- theApp.m_pDlg->m_Message.SetWorkingMsg(0);
- theApp.m_pDlg->m_Message.SetAction(3); //Fetch First
- ULONG mCount=0;
- while (theApp.m_pDlg->m_Message.GetErrorNum()==0)
- {
- BOOL IsUnread;
- CString Subject;
- long MsgNum;
- mCount++;
- Subject=theApp.m_pDlg->m_Message.GetSubject();
- IsUnread=theApp.m_pDlg->m_Message.GetUnreadMsg();
- MsgNum=theApp.m_pDlg->m_Message.GetFetchMsg();
- m_List.InsertItem( LVIF_TEXT|LVIF_PARAM,
- 0,
- (const char *) Subject,
- 0,
- 0,
- (int) !IsUnread,
- (LPARAM) MsgNum);
-
- theApp.m_pDlg->m_Message.SetAction(2); //Fetch Next
- }
-
- EndWaitCursor();
- char szTemp[25];
- wsprintf(szTemp,"%lu",mCount);
- m_TotalNum=szTemp;
- m_List.SetRedraw(TRUE);
-
- /* Clear Next Page Items!*/
- pSheet->m_Page4.m_szSubject=_T("");
- pSheet->m_Page4.m_szNotePart=_T("");
- pSheet->m_Page4.m_szFrom=_T("");
- m_InboxMsg=FALSE;
- return CPropertyPage::OnSetActive();
- }
-
- BOOL CMyPropertyPage3::OnInitDialog()
- {
- CPropertyPage::OnInitDialog();
-
- // TODO: Add extra initialization here
- m_ImageList.Create(IDB_IMAGELIST,32,4,RGB(255,255,255));
- m_List.SetImageList(&m_ImageList,LVSIL_SMALL);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
-
- BOOL CMyPropertyPage5::OnSetActive()
- {
- // TODO: Add your specialized code here and/or call the base class
- CPropertySheet *pSheet=(CPropertySheet *) GetParent();
- pSheet->SetWizardButtons(PSWIZB_FINISH|PSWIZB_BACK);
-
- return CPropertyPage::OnSetActive();
- }
-
- BOOL CMyPropertyPage4::OnSetActive()
- {
- // TODO: Add your specialized code here and/or call the base class
- CMyPropertySheet *pSheet=(CMyPropertySheet *) GetParent();
- pSheet->SetWizardButtons(PSWIZB_NEXT|PSWIZB_BACK);
-
- if (pSheet->m_Page3.m_InboxMsg)
- {
- pSheet->m_Page4.m_Forward.EnableWindow(TRUE);
- pSheet->m_Page4.m_Reply.EnableWindow(TRUE);
- }
- else
- {
- pSheet->m_Page4.m_Forward.EnableWindow(FALSE);
- pSheet->m_Page4.m_Reply.EnableWindow(FALSE);
- }
-
- return CPropertyPage::OnSetActive();
- }
-
- void CMyPropertyPage3::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- CMyPropertySheet *pSheet=(CMyPropertySheet *) GetParent();
-
- int Index;
- Index=m_List.GetNextItem(-1,LVNI_SELECTED|LVNI_FOCUSED);
- if (Index>=0)
- {
- long MsgNum=m_List.GetItemData(Index);
-
- theApp.m_pDlg->m_ReadMsg.SetWorkingMsg(0);
- theApp.m_pDlg->m_ReadMsg.SetFetchMsg(MsgNum);
-
- if (theApp.m_pDlg->m_ReadMsg.GetErrorNum()==0)
- {
- theApp.m_pDlg->m_Originator.SetFetchRecipient(TRUE);
- pSheet->m_Page4.m_szSubject=theApp.m_pDlg->m_ReadMsg.GetSubject();
- pSheet->m_Page4.m_szNotePart=theApp.m_pDlg->m_ReadMsg.GetNoteText();
- pSheet->m_Page4.m_szFrom=theApp.m_pDlg->m_Originator.GetRecipientName();
- m_InboxMsg=TRUE;
- pSheet->PressButton(PSBTN_NEXT);
- }
-
- }
-
- *pResult = 0;
- }
-
- void CMyPropertyPage4::OnSend()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- theApp.m_pDlg->m_ReadMsg.SetAction(7); //New Message
- theApp.m_pDlg->m_ReadMsg.SetWorkingMsg(1);
- theApp.m_pDlg->m_ReadMsg.SetSubject(m_szSubject);
- theApp.m_pDlg->m_ReadMsg.SetNoteText(m_szNotePart);
- theApp.m_pDlg->m_ReadMsg.SetAction(13); //Send Message
- if (theApp.m_pDlg->m_ReadMsg.GetErrorNum()!=0)
- {
- MessageBox("Unable to Send Message","Mail eXtension OCX-32 v1.60",MB_ICONSTOP);
- }
-
- }
-
- void CMyPropertyPage4::OnReply()
- {
- // TODO: Add your control notification handler code here
- theApp.m_pDlg->m_ReadMsg.SetAction(8); //New Message
- theApp.m_pDlg->m_ReadMsg.SetWorkingMsg(0);
- theApp.m_pDlg->m_ReadMsg.SetAction(13); //Send Message
- if (theApp.m_pDlg->m_ReadMsg.GetErrorNum()!=0)
- {
- MessageBox("Unable to Send Message","Mail eXtension OCX-32 v1.60",MB_ICONSTOP);
- }
- }
-
- void CMyPropertyPage4::OnForward()
- {
- // TODO: Add your control notification handler code here
- theApp.m_pDlg->m_ReadMsg.SetAction(9); //Forward Message
- theApp.m_pDlg->m_ReadMsg.SetWorkingMsg(0);
- theApp.m_pDlg->m_ReadMsg.SetAction(13); //Send Message
- if (theApp.m_pDlg->m_ReadMsg.GetErrorNum()!=0)
- {
- MessageBox("Unable to Send Message","Mail eXtension OCX-32 v1.60",MB_ICONSTOP);
- }
-
- }
-