构造函数:
CTrain::CTrain(CTestDlg *pDlg) : m_pDlg(pDlg)
{}
成员函数:
void CTrain::Display(CListBox *TestInfo)
{
TestInfo->AddString("hello");
}void CTrain::Process()
{
Display(&(m_pDlg->m_TestInfo));}CTestDlg类中调用:
CTestDlg *Dlg = new CTestDlg();
CTrain Train(Dlg);
Train.Process();会出异常:_AFXWIN_INLINE int CListBox::InsertString(int nIndex, LPCTSTR lpszItem)
{ ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, LB_INSERTSTRING, nIndex, (LPARAM)lpszItem); }
CTrain::CTrain(CTestDlg *pDlg) : m_pDlg(pDlg)
{}
成员函数:
void CTrain::Display(CListBox *TestInfo)
{
TestInfo->AddString("hello");
}void CTrain::Process()
{
Display(&(m_pDlg->m_TestInfo));}CTestDlg类中调用:
CTestDlg *Dlg = new CTestDlg();
CTrain Train(Dlg);
Train.Process();会出异常:_AFXWIN_INLINE int CListBox::InsertString(int nIndex, LPCTSTR lpszItem)
{ ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, LB_INSERTSTRING, nIndex, (LPARAM)lpszItem); }
{
ASSERT(HIWORD(lpszTemplateName) == 0 ||
AfxIsValidString(lpszTemplateName));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~异常
m_lpszTemplateName = lpszTemplateName; // used for help