DragonNest/Server/ServiceManagerEx/CommandListDlg.cpp

88 lines
1.8 KiB
C++
Raw Permalink Normal View History

// CommandListDlg.cpp : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
//
#include "stdafx.h"
#include "ServiceManagerEx.h"
#include "CommandListDlg.h"
#include "ServiceManager.h"
extern CServiceManager* g_pServiceManager;
IMPLEMENT_DYNAMIC(CCommandListDlg, CDialog)
CCommandListDlg::CCommandListDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCommandListDlg::IDD, pParent)
{
}
CCommandListDlg::~CCommandListDlg()
{
}
void CCommandListDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CCommandListDlg, CDialog)
ON_LBN_DBLCLK(IDC_LIST_COMMAND_LIST, &CCommandListDlg::OnLbnDblclkListCommandList)
ON_BN_CLICKED(IDOK, &CCommandListDlg::OnBnClickedOk)
END_MESSAGE_MAP()
// CCommandListDlg <20>޽<EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
BOOL CCommandListDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: <20><><EFBFBD><20>߰<EFBFBD> <20>ʱ<EFBFBD>ȭ <20>۾<EFBFBD><DBBE><EFBFBD> <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
const map<const wstring, int>& commands = g_pServiceManager->GetCommandList();
CListBox* pList = (CListBox*)GetDlgItem(IDC_LIST_COMMAND_LIST);
ASSERT(pList);
for each (map<const wstring, int>::value_type v in commands)
{
pList->AddString(v.first.c_str());
}
return TRUE; // return TRUE unless you set the focus to a control
// <20><><EFBFBD><EFBFBD>: OCX <20>Ӽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FALSE<53><45> <20><>ȯ<EFBFBD>ؾ<EFBFBD> <20>մϴ<D5B4>.
}
void CCommandListDlg::OnLbnDblclkListCommandList()
{
// TODO: <20><><EFBFBD><20><>Ʈ<EFBFBD><C6AE> <20>˸<EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
SetCommand();
OnOK();
}
void CCommandListDlg::OnBnClickedOk()
{
// TODO: <20><><EFBFBD><20><>Ʈ<EFBFBD><C6AE> <20>˸<EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
SetCommand();
if (m_Command.empty())
{
::AfxMessageBox(L"Command not selected.", MB_ICONASTERISK);
return;
}
OnOK();
}
void CCommandListDlg::SetCommand()
{
m_Command.clear();
CListBox* pList = (CListBox*)GetDlgItem(IDC_LIST_COMMAND_LIST);
ASSERT(pList);
int sel = pList->GetCurSel();
if (sel < 0)
return;
wchar_t command[256];
pList->GetText(sel, command);
m_Command = command;
}