// GroupDlg.cpp : implementation file // #include "stdafx.h" #include "vector.h" #include "GroupDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CGroupDlg dialog CGroupDlg::CGroupDlg(CWnd* pParent /*=NULL*/) : CDialog(CGroupDlg::IDD, pParent) { //{{AFX_DATA_INIT(CGroupDlg) //}}AFX_DATA_INIT m_pVector = NULL; m_nGroupIndex = 0; } void CGroupDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CGroupDlg) DDX_Control(pDX, IDC_GROUPS, m_ListBox); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CGroupDlg, CDialog) //{{AFX_MSG_MAP(CGroupDlg) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CGroupDlg message handlers BOOL CGroupDlg::OnInitDialog() { CDialog::OnInitDialog(); if (m_pVector != NULL) { int nCount, i, nIndex; //pGroupsDlgData = (LPGROUPSDLGDATA) lParam; //hWndList = GetDlgItem( hWnd, IDC_GROUPS ); nCount = m_pVector->GetGroupCount(); for( i = 0; i < nCount; i++ ) { LVectorGroup VectorGroup; VECTORGROUPDESC VectorGroupDesc; m_pVector->GetGroupByIndex(i, &VectorGroup ); VectorGroup.GetGroupDesc(&VectorGroupDesc); nIndex = m_ListBox.AddString(VectorGroupDesc.szName); m_ListBox.SetItemData(nIndex, i); } m_ListBox.SetCurSel(0); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } BOOL CGroupDlg::OnCommand(WPARAM wParam, LPARAM lParam) { switch (LOWORD(wParam)) { case IDOK: m_nGroupIndex = m_ListBox.GetCurSel(); break; } return CDialog::OnCommand(wParam, lParam); }