// CommandListDlg.cpp : ±¸Çö ÆÄÀÏÀÔ´Ï´Ù. // #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 ¸Þ½ÃÁö 󸮱âÀÔ´Ï´Ù. BOOL CCommandListDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: ¿©±â¿¡ Ãß°¡ ÃʱâÈ­ ÀÛ¾÷À» Ãß°¡ÇÕ´Ï´Ù. const map& commands = g_pServiceManager->GetCommandList(); CListBox* pList = (CListBox*)GetDlgItem(IDC_LIST_COMMAND_LIST); ASSERT(pList); for each (map::value_type v in commands) { pList->AddString(v.first.c_str()); } return TRUE; // return TRUE unless you set the focus to a control // ¿¹¿Ü: OCX ¼Ó¼º ÆäÀÌÁö´Â FALSE¸¦ ¹ÝÈ¯ÇØ¾ß ÇÕ´Ï´Ù. } void CCommandListDlg::OnLbnDblclkListCommandList() { // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. SetCommand(); OnOK(); } void CCommandListDlg::OnBnClickedOk() { // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. 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; }