|
|
/*++
Copyright (c) 1994-2001 Microsoft Corporation
Module Name : fmessage.cpp
Abstract: FTP Messages property page
Author: Ronald Meijer (ronaldm) Sergei Antonov (sergeia)
Project: Internet Services Manager
Revision History:
--*/
//
// Include Files
//
#include "stdafx.h"
#include "common.h"
#include "inetprop.h"
#include "InetMgrApp.h"
#include "shts.h"
#include "ftpsht.h"
#include "fmessage.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__; #endif
IMPLEMENT_DYNCREATE(CFtpMessagePage, CInetPropertyPage)
CFtpMessagePage::CFtpMessagePage( IN CInetPropertySheet * pSheet ) /*++
Routine Description:
Constructor for FTP message property page
Arguments:
CInetPropertySheet * pSheet : Associated property sheet
Return Value:
N/A
--*/ : CInetPropertyPage(CFtpMessagePage::IDD, pSheet) { #ifdef _DEBUG
afxMemDF |= checkAlwaysMemDF;
#endif // _DEBUG
#if 0 // Keep class wizard happy
//{{AFX_DATA_INIT(CFtpMessagePage)
m_strExitMessage = _T(""); m_strMaxConMsg = _T(""); m_strWelcome = _T(""); //}}AFX_DATA_INIT
#endif // 0
m_hInstRichEdit = LoadLibrary(_T("RichEd20.dll")); }
CFtpMessagePage::~CFtpMessagePage() /*++
Routine Description:
Destructor
Arguments:
N/A
Return Value:
N/A
--*/ { if (m_hInstRichEdit != NULL) FreeLibrary(m_hInstRichEdit); }
void CFtpMessagePage::DoDataExchange( IN CDataExchange * pDX ) /*++
Routine Description:
Initialise/Store control data
Arguments:
CDataExchange * pDX - DDX/DDV control structure
Return Value:
None
--*/ { CInetPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFtpMessagePage)
DDX_Control(pDX, IDC_EDIT_EXIT, m_edit_Exit); DDX_Control(pDX, IDC_EDIT_MAX_CONNECTIONS, m_edit_MaxCon); DDX_Text(pDX, IDC_EDIT_EXIT, m_strExitMessage); DDX_Text(pDX, IDC_EDIT_MAX_CONNECTIONS, m_strMaxConMsg); DDX_Text(pDX, IDC_EDIT_WELCOME, m_strWelcome); DDX_Text(pDX, IDC_EDIT_BANNER, m_strBanner); //}}AFX_DATA_MAP
}
//
// Message Map
//
BEGIN_MESSAGE_MAP(CFtpMessagePage, CInetPropertyPage) ON_EN_CHANGE(IDC_EDIT_EXIT, OnItemChanged) ON_EN_CHANGE(IDC_EDIT_MAX_CONNECTIONS, OnItemChanged) ON_EN_CHANGE(IDC_EDIT_WELCOME, OnItemChanged) ON_EN_CHANGE(IDC_EDIT_BANNER, OnItemChanged) END_MESSAGE_MAP()
BOOL CFtpMessagePage::OnInitDialog() { CInetPropertyPage::OnInitDialog();
CHARFORMAT2 cf; ZeroMemory(&cf, sizeof(cf)); cf.cbSize = sizeof(cf); cf.dwMask = CFM_FACE | CFM_WEIGHT; cf.wWeight = FW_REGULAR; lstrcpyn((LPTSTR)cf.szFaceName, _T("Courier New"), LF_FACESIZE);
DWORD event; if (GetSheet()->QueryMajorVersion() >= 6) { SendDlgItemMessage(IDC_EDIT_BANNER, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf); event = (DWORD)SendDlgItemMessage(IDC_EDIT_BANNER, EM_GETEVENTMASK, 0, 0); event |= ENM_CHANGE; SendDlgItemMessage(IDC_EDIT_BANNER, EM_SETEVENTMASK, 0, (LPARAM)event); } else { CRect rcText, rcBanner, rcWelcome; CWnd * pbt, * pwt, * pbe, * pwe; pbt = GetDlgItem(IDC_STATIC_BANNER); pbe = GetDlgItem(IDC_EDIT_BANNER); pwt = GetDlgItem(IDC_STATIC_WELCOME); pwe = GetDlgItem(IDC_EDIT_WELCOME); pbt->GetWindowRect(&rcText); ScreenToClient(&rcText); pbe->GetWindowRect(&rcBanner); ScreenToClient(&rcBanner); pbt->EnableWindow(FALSE); pbt->ShowWindow(SW_HIDE); pbe->EnableWindow(FALSE); pbe->ShowWindow(SW_HIDE); pwt->SetWindowPos(NULL, rcText.left, rcText.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pwe->GetWindowRect(&rcWelcome); ScreenToClient(&rcWelcome); pwe->SetWindowPos(NULL, rcBanner.left, rcBanner.top, rcWelcome.Width(), rcWelcome.bottom - rcBanner.top, SWP_NOZORDER); } SendDlgItemMessage(IDC_EDIT_WELCOME, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf); event = (DWORD)SendDlgItemMessage(IDC_EDIT_WELCOME, EM_GETEVENTMASK, 0, 0); event |= ENM_CHANGE; SendDlgItemMessage(IDC_EDIT_WELCOME, EM_SETEVENTMASK, 0, (LPARAM)event);
return TRUE; }
/* virtual */ HRESULT CFtpMessagePage::FetchLoadedValues() /*++
Routine Description: Move configuration data from sheet to dialog controls
Arguments:
None
Return Value:
HRESULT
--*/ { CError err;
BEGIN_META_INST_READ(CFtpSheet)
//
// Use m_ notation because the message cracker functions require it.
//
CStringListEx m_strlWelcome, m_strlBanner; FETCH_INST_DATA_FROM_SHEET(m_strExitMessage); FETCH_INST_DATA_FROM_SHEET(m_strMaxConMsg); FETCH_INST_DATA_FROM_SHEET(m_strlWelcome); FETCH_INST_DATA_FROM_SHEET(m_strlBanner);
//
// Incoming strings contain '\r' at the end of each string.
// Append a '\n' for internal consumption
//
ConvertStringListToSepLine(m_strlWelcome, m_strWelcome, _T("\n")); ConvertStringListToSepLine(m_strlBanner, m_strBanner, _T("\n"));
END_META_INST_READ(err)
return err; }
/* virtual */ HRESULT CFtpMessagePage::SaveInfo() /*++
Routine Description:
Save the information on this property page
Arguments:
None
Return Value:
Error return code
--*/ { ASSERT(IsDirty());
TRACEEOLID("Saving FTP message page now...");
CError err;
BeginWaitCursor();
//
// Use m_ notation because the message cracker macros require
// it.
//
CStringListEx m_strlWelcome, m_strlBanner; ConvertSepLineToStringList(m_strWelcome, m_strlWelcome, _T("\n")); ConvertSepLineToStringList(m_strBanner, m_strlBanner, _T("\n"));
BEGIN_META_INST_WRITE(CFtpSheet) STORE_INST_DATA_ON_SHEET(m_strExitMessage) STORE_INST_DATA_ON_SHEET(m_strMaxConMsg) STORE_INST_DATA_ON_SHEET(m_strlWelcome) STORE_INST_DATA_ON_SHEET(m_strlBanner) END_META_INST_WRITE(err)
EndWaitCursor();
return err; }
void CFtpMessagePage::OnItemChanged() /*++
Routine Description:
Register a change in control value on this page. Mark the page as dirty. All change messages map to this function
Arguments:
None
Return Value:
None
--*/ { SetModified(TRUE); }
|