如何使用类中的变量
renzu 2009-11-13 10:11:07 一个MFC程序,增加了一个LIST control控件,
变量名 :m_clist_control ,在外部变量使用时提示为定义,怎样才能解决?
class CMyDlg : public CDialog
{
// Construction
public:
CMyDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CMyDlg)
enum { IDD = IDD_MY_DIALOG };
CListCtrl m_clist_control;
CStatic m_path;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
void BrowseFile(CString strPath);
// Generated message map functions
//{{AFX_MSG(CMyDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnScan();
afx_msg void OnSelchangeList1();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif
test()
{
m_clist_control.SetItemText(0, 1, "listbuf");//这里提示m_clist_control' : undeclared identifier
}