Hi Rob,
Here is the code: The funny thing is that it will compile and run. When I try to open the Class Wizard I get an error message popup: Parsing error: Expected "afx_msg" Input Line: "void PopulateCombo". I did put afx_msg in front of PopulateCombo() and things seem fine.
My main question is could I use the Class Wizard to add this function?
Header File ListExDlg.h
// ListExDlg.h : header file
//
#if !defined(AFX_LISTEXDLG_H__8D87AD57_5C3E_43A8_B375_E70BC67FADD6__INCLUDED_)
#define AFX_LISTEXDLG_H__8D87AD57_5C3E_43A8_B375_E70BC67FADD6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CListExDlg dialog
class CListExDlg : public CDialog
{
// Construction
public:
CListExDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CListExDlg)
enum { IDD = IDD_LISTEX_DIALOG };
CListCtrl m_lbDirDetails;
CTreeCtrl m_treeFiles;
CListBox m_lbSubDirs;
CComboBox m_cbMainDir;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CListExDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CListExDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
void PopulateCombo();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_LISTEXDLG_H__8D87AD57_5C3E_43A8_B375_E70BC67FADD6__INCLUDED_)
************************************************************
Here are the OnInitDialog() and PopulateCombo() functions in ListExDlg.cpp
OnInitDialog()
BOOL CListExDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
PopulateCombo();
return TRUE; // return TRUE unless you set the focus to a control
}
PopulateCombo()
void CListExDlg:

opulateCombo()
{
TCHAR szBuffer[MAX_PATH];
//Get the Windows directory, usually C:\Windows
//and add to the combo box
GetWindowsDirectory(szBuffer, MAX_PATH);
m_cbMainDir.AddString(szBuffer);
//** Chop off the directory to leave the drive letter C:
//** and add to the combo box
szBuffer[2]=0;
m_cbMainDir.AddString(szBuffer);
//** Get the System directory
//** Usually C:\Windows\System and add to the combo box
GetSystemDirectory(szBuffer, MAX_PATH);
m_cbMainDir.AddString(szBuffer);
//** Get the present directory and add to the combo box
GetCurrentDirectory(MAX_PATH, szBuffer);
m_cbMainDir.AddString(szBuffer);
}