VC文本编程

来源:百度知道 编辑:UC知道 时间:2024/09/25 21:28:02
请问如何在自定义类中获得View类中文本框的内容。
我用
char *str;
CMainFrame *pMain=(CMainFrame *)AfxGetApp()->m_pMainWnd;
CFileSelectView *pView=(CFileSelectView *)pMain->GetActiveView();
pView->GetDlgItemText(IDC_EDIT1,str);
为什么报错呢?
我加载了头文件。
--------------------Configuration: FileSelect - Win32 Debug--------------------
Compiling...
showdlg.cpp
c:\documents and settings\owner\桌面\vc\复件 fileselect\showdlg.cpp(4) : warning C4652: compiler option 'Generate Browser Info' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
c:\documents and settings\owner\桌面\vc\复件 fileselect\fileselectview.h(28) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\owner\桌面\vc\复件 fileselect\fileselectview.h(28) : error C2501: 'CFileSelectDoc' : missing storage-class o

在你自定义类#inlucde "FileSelectView.h"之前先#inlucde "FileSelectDoc.h"

如果你们文件名不是这个改成你的那个。

CString str;
CMainFrame *pMain=(CMainFrame *)AfxGetApp()->m_pMainWnd;
CFileSelectView *pView=(CFileSelectView *)pMain->GetActiveView();
pView->GetDlgItemText(IDC_EDIT1,str);