/****************************************************************/ /* */ /* ConfigurationPage.cpp */ /* */ /* Implementation of the CConfigurationPage class. */ /* This class is a part of the FTP Server Application */ /* */ /* 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 "ConfigurationPage.h" //#include "UserAccountsDlg.h" #include "DBServerDlg.h" #include "InputCode.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CtheDBServer theServer; extern CDBServer theApp; CConfigurationPage::CConfigurationPage() : CDialogResize(CConfigurationPage::IDD) { //{{AFX_DATA_INIT(CConfigurationPage) m_strGoodbyeMessage = _T(""); m_bStartInTray = FALSE; m_strWelcomeMessage = _T(""); m_bLaunchOnStartup = FALSE; m_bAutoActivate = FALSE; m_nLogLevel = 0; m_strApplicationName = _T(""); m_version = _T(""); m_versionno = _T(""); m_company = _T(""); //}}AFX_DATA_INIT m_bModified = FALSE; m_pImage=NULL; } CConfigurationPage::~CConfigurationPage() { // if( m_pImage ) delete m_pImage;m_pImage=NULL; } void CConfigurationPage::DoDataExchange(CDataExchange* pDX) { CDialogResize::DoDataExchange(pDX); //{{AFX_DATA_MAP(CConfigurationPage) DDX_Text(pDX, IDC_GOODBYE_MSG, m_strGoodbyeMessage); DDX_Check(pDX, IDC_START_IN_TRAY, m_bStartInTray); DDX_Text(pDX, IDC_WELCOME_MSG, m_strWelcomeMessage); DDX_Check(pDX, IDC_LAUNCH_ON_STARTUP, m_bLaunchOnStartup); DDX_Check(pDX, IDC_AUTOACTIVATE, m_bAutoActivate); DDX_CBIndex(pDX, IDC_LOGLEVEL, m_nLogLevel); DDX_Text(pDX, IDC_APPLICATIONNAME, m_strApplicationName); DDX_Text(pDX, IDC_PORT, m_version); DDX_Text(pDX, IDC_MAX_USERS, m_versionno); DDX_Text(pDX, IDC_TIMEOUT, m_company); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CConfigurationPage, CDialogResize) //{{AFX_MSG_MAP(CConfigurationPage) ON_WM_DESTROY() ON_BN_CLICKED(IDC_LAUNCH_ON_STARTUP, OnLaunchOnStartup) ON_BN_CLICKED(IDC_VIEW, OnView) ON_BN_CLICKED(IDC_CLEAR, OnClear) ON_UPDATE_COMMAND_UI(IDC_APPLY, OnUpdateApply) ON_EN_CHANGE(IDC_PORT, OnSomethingChanged) ON_BN_CLICKED(IDC_APPLY, OnApply) ON_EN_CHANGE(IDC_MAX_USERS, OnSomethingChanged) ON_EN_CHANGE(IDC_TIMEOUT, OnSomethingChanged) ON_EN_CHANGE(IDC_WELCOME_MSG, OnSomethingChanged) ON_EN_CHANGE(IDC_GOODBYE_MSG, OnSomethingChanged) ON_CBN_SELCHANGE(IDC_LOGLEVEL, OnSomethingChanged) ON_BN_CLICKED(IDC_START_IN_TRAY, OnSomethingChanged) ON_BN_CLICKED(IDC_AUTOACTIVATE, OnSomethingChanged) ON_EN_CHANGE(IDC_APPLICATIONNAME, OnSomethingChanged) ON_WM_PAINT() //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_DLGRESIZE_MAP(CConfigurationPage) DLGRESIZE_CONTROL(IDC_WELCOME_MSG, DLSZ_SIZE_X) DLGRESIZE_CONTROL(IDC_GOODBYE_MSG, DLSZ_SIZE_X) DLGRESIZE_CONTROL(IDC_APPLICATIONNAME, DLSZ_SIZE_X) DLGRESIZE_CONTROL(IDC_VIEW, DLSZ_MOVE_X) DLGRESIZE_CONTROL(IDC_CLEAR, DLSZ_MOVE_X) DLGRESIZE_CONTROL(IDC_APPLY, DLSZ_MOVE_X | DLSZ_MOVE_Y) DLGRESIZE_CONTROL(IDC_IPLIST, DLSZ_SIZE_Y) END_DLGRESIZE_MAP() /********************************************************************/ /* */ /* Function name : OnInitDialog */ /* Description : Called by the framework in response to the */ /* WM_INITDIALOG message. */ /* */ /********************************************************************/ extern void LoadImageFromRes(Image **img, LPCTSTR lpszResourceName, LPCTSTR ResourceType); BOOL CConfigurationPage::OnInitDialog() { CDialogResize::OnInitDialog(); m_version=""; #ifdef CHILD_VERSION m_version+="儿童"; #else m_version+="婚纱"; #endif #ifdef ENTERPRISE_VERSION m_version+="集团版"; #endif #ifdef CONNCOUNT_VERSION CString temp; temp.Format ("座席版"); m_version+=temp; #endif if(m_version=="婚纱" || m_version=="儿童") m_version+="全能版"; m_versionno="00000"; m_company="利亚方舟软件开发有限公司"; m_strWelcomeMessage="www.lyfz.net 4006-067-068"; UpdateData(false); LoadImageFromRes(&m_pImage, MAKEINTRESOURCE(IDR_PNG1), _T("png") ); return TRUE; } /********************************************************************/ /* */ /* Function name : OnDestroy */ /* Description : Called by the framework in response to the */ /* WM_DESTROY message. */ /* */ /********************************************************************/ void CConfigurationPage::OnDestroy() { CDialogResize::OnDestroy(); } /********************************************************************/ /* */ /* Function name : OnLaunchOnStartup */ /* Description : Launch application on startup? */ /* */ /********************************************************************/ void CConfigurationPage::OnLaunchOnStartup() { UpdateData(TRUE); if (m_bLaunchOnStartup) { char szModuleFilename[MAX_PATH]; // Get application's full path. ::GetModuleFileName(NULL, szModuleFilename, MAX_PATH); // create shortcut CreateStartMenuShortcut(szModuleFilename, "FTP Server", "Startup"); } else { // remove shortcut RemoveStartMenuShortcut("FTP Server", "Startup"); } OnSomethingChanged(); } /********************************************************************/ /* */ /* Function name : OnView */ /* Description : View log file contents. */ /* */ /********************************************************************/ void CConfigurationPage::OnView() // 医院跟踪功能; { /* int ExecStatus = (UINT)ShellExecute(m_hWnd, "open", "NOTEPAD.EXE", (LPCTSTR)theApp.m_LogFile.m_FileName, 0, SW_SHOW); switch(ExecStatus) { case 0: MessageBox("Systeem is out of Memory","ShellExecute Error",MB_OK | MB_ICONEXCLAMATION); break; case 2: MessageBox("'NOTEPAD.EXE' is not found !","ShellExecute Error",MB_OK | MB_ICONEXCLAMATION); break; default: if (ExecStatus <= 32) MessageBox("Problem with executing of NOTEPAD.EXE","ShellExecute Error",MB_OK | MB_ICONEXCLAMATION); break; } */ InputCode dlg; dlg.DoModal (); } /********************************************************************/ /* */ /* Function name : OnClear */ /* Description : Clear log file contents. */ /* */ /********************************************************************/ void CConfigurationPage::OnClear() { theApp.m_LogFile.Clear(); } /********************************************************************/ /* */ /* Function name : OnApply */ /* Description : Update FTP server settings. */ /* */ /********************************************************************/ void CConfigurationPage::OnApply() { } /********************************************************************/ /* */ /* Function name : OnUpdateApply */ /* Description : Update button state. */ /* */ /********************************************************************/ void CConfigurationPage::OnUpdateApply(CCmdUI* pCmdUI) { pCmdUI->Enable(m_bModified); } /********************************************************************/ /* */ /* Function name : OnSomethingChanged */ /* Description : Something has changed... */ /* */ /********************************************************************/ void CConfigurationPage::OnSomethingChanged() { m_bModified = TRUE; UpdateDialogControls(this, FALSE); } void CConfigurationPage::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here if(m_pImage) { CRect rc; GetDlgItem(IDC_STATIC1)->GetWindowRect(rc); ScreenToClient(rc); Graphics dcgraph(dc.GetSafeHdc()); Rect destinationRect(rc.left , rc.top , rc.Width (), rc.Height ()); dcgraph.DrawImage(m_pImage, destinationRect, 0,0,m_pImage->GetWidth(), m_pImage->GetHeight(),UnitPixel); } // Do not call CDialogResize::OnPaint() for painting messages }