123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- /****************************************************************/
- /* */
- /* 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
- }
|