📄 serverfilepathdlg.cpp
字号:
// ServerFilePathDlg.cpp : implementation file
//
#include "stdafx.h"
#include "RMTool.h"
#include "ServerFilePathDlg.h"
#include "ServerPatch.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CServerFilePathDlg dialog
CServerFilePathDlg::CServerFilePathDlg(CWnd* pParent /*=NULL*/)
: CDialog(CServerFilePathDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CServerFilePathDlg)
m_AgentPath = _T("");
m_DbdemonPath = _T("");
m_MapPath = _T("");
m_ProxyPath = _T("");
//}}AFX_DATA_INIT
}
void CServerFilePathDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CServerFilePathDlg)
DDX_Text(pDX, IDC_EDIT_AGENT, m_AgentPath);
DDX_Text(pDX, IDC_EDIT_DBDEMON, m_DbdemonPath);
DDX_Text(pDX, IDC_EDIT_MAP, m_MapPath);
DDX_Text(pDX, IDC_EDIT_PROXY, m_ProxyPath);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CServerFilePathDlg, CDialog)
//{{AFX_MSG_MAP(CServerFilePathDlg)
ON_BN_CLICKED(IDC_BUTTON_PROXY_BROWSE, OnButtonProxyBrowse)
ON_BN_CLICKED(IDC_BUTTON_AGENT_BROWSE, OnButtonAgentBrowse)
ON_BN_CLICKED(IDC_BUTTON_DBDEMON_BROWSE, OnButtonDbdemonBrowse)
ON_BN_CLICKED(IDC_BUTTON_MAP_BROWSE, OnButtonMapBrowse)
ON_WM_DROPFILES()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CServerFilePathDlg message handlers
void CServerFilePathDlg::OnButtonProxyBrowse()
{
// TODO: Add your control notification handler code here
DWORD dwMode;
dwMode= OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
CFileDialog dlg(TRUE, "exe", "*.exe", dwMode, "Server Executable File(*.exe)");
if (dlg.DoModal()== IDOK)
{
m_ProxyPath = dlg.GetPathName();
UpdateData(FALSE);
}
}
void CServerFilePathDlg::OnButtonAgentBrowse()
{
// TODO: Add your control notification handler code here
DWORD dwMode;
dwMode= OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
CFileDialog dlg(TRUE, "exe", "*.exe", dwMode, "Server Executable File(*.exe)");
if (dlg.DoModal()== IDOK)
{
m_AgentPath = dlg.GetPathName();
UpdateData(FALSE);
}
}
void CServerFilePathDlg::OnButtonDbdemonBrowse()
{
// TODO: Add your control notification handler code here
DWORD dwMode;
dwMode= OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
CFileDialog dlg(TRUE, "exe", "*.exe", dwMode, "Server Executable File(*.exe)");
if (dlg.DoModal()== IDOK)
{
m_DbdemonPath = dlg.GetPathName();
UpdateData(FALSE);
}
}
void CServerFilePathDlg::OnButtonMapBrowse()
{
// TODO: Add your control notification handler code here
DWORD dwMode;
dwMode= OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
CFileDialog dlg(TRUE, "exe", "*.exe", dwMode, "Server Executable File(*.exe)");
if (dlg.DoModal()== IDOK)
{
m_MapPath = dlg.GetPathName();
UpdateData(FALSE);
}
}
void CServerFilePathDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
char path[ MAX_PATH ];
__PATH
//sprintf(path,"%s\\Setup.ini",m_pApp->GetInstalledPath());
m_pApp->m_szServerFile[ m_nCurServerSet ][0] = m_ProxyPath;
m_pApp->m_szServerFile[ m_nCurServerSet ][1] = m_AgentPath;
m_pApp->m_szServerFile[ m_nCurServerSet ][2] = m_DbdemonPath;
m_pApp->m_szServerFile[ m_nCurServerSet ][3] = m_MapPath;
char key[ 0xff ]; memset(key,0,0xff);
char app[ 0xff ]; memset(app,0,0xff);
sprintf(app,"RecentFile%d",m_nCurServerSet + 1);
for(int i=0; i<4 ; i++)
{
sprintf(key,"File%d", i+1);
WritePrivateProfileString(app,key,m_pApp->m_szServerFile[ m_nCurServerSet ][i],path);
}
CDialog::OnOK();
}
BOOL CServerFilePathDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_pApp = (CRMToolApp*)AfxGetApp();
// TODO: Add extra initialization here
m_ProxyPath = m_pApp->m_szServerFile[ m_nCurServerSet ][0];
m_AgentPath = m_pApp->m_szServerFile[ m_nCurServerSet ][1];
m_DbdemonPath = m_pApp->m_szServerFile[ m_nCurServerSet ][2];
m_MapPath = m_pApp->m_szServerFile[ m_nCurServerSet ][3];
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
}
void CServerFilePathDlg::OnDropFiles(HDROP hDropInfo)
{
//kyo
#ifdef __COMPACT__
AfxMessageBox( "RUN Only Full_version");
return;
#endif
// TODO: Add your message handler code here and/or call default
int count = 0;
char szFileName[_MAX_PATH];
CString szTemp,szTemp2,szTemp3;
//CServerView* pView = (CServerView*)GetParent();
count = ::DragQueryFile(hDropInfo, 0xFFFFFFFF, szFileName, _MAX_PATH);
for(int i=0; i < count; i++)
{
::DragQueryFile(hDropInfo, i, szFileName, _MAX_PATH);
szTemp = szFileName;
szTemp2 = szTemp.Right(szTemp.GetLength() - szTemp.ReverseFind('\\') - 1);
//Proxy Server
szTemp3 = szTemp2.Mid(0,11);
szTemp3.MakeLower();
if(szTemp3 == "proxyserver")
{
m_pApp->m_szServerFile[ m_nCurServerSet ][0] = szFileName;
m_ProxyPath = szTemp;
continue;
}
//Agent Server
szTemp3 = szTemp2.Mid(0,11);
szTemp3.MakeLower();
if(szTemp3 == "agentserver")
{
m_pApp->m_szServerFile[ m_nCurServerSet ][1] = szFileName;
m_AgentPath = szTemp;
continue;
}
//DB Demon
szTemp3 = szTemp2.Mid(0,7);
szTemp3.MakeLower();
if(szTemp3 == "dbdemon")
{
m_pApp->m_szServerFile[ m_nCurServerSet ][2] = szFileName;
m_DbdemonPath = szTemp;
continue;
}
//MapServer
szTemp3 = szTemp2.Mid(0,9);
szTemp3.MakeLower();
if(szTemp3 == "mapserver")
{
m_pApp->m_szServerFile[ m_nCurServerSet ][3] = szTemp;
m_MapPath = szTemp;
continue;
}
}
::DragFinish(hDropInfo);
UpdateData(FALSE);
CDialog::OnDropFiles(hDropInfo);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -