关于CFindReplaceDialog http://www.codeproject.com/dialog/cfindreplacedialog.aspUsing the CFindReplaceDialog class 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不行啊,运行有错误,估计是自己不行,:(,这么多问题真不好意思了有4个错误:E:\YlxProjects\testa\testaView.cpp(26) : error C2065: 'm_FindDialogMessage' : undeclared identifierE:\YlxProjects\testa\testaView.cpp(39) : error C2758: 'm_pFindDialogMessage' : must be initialized in constructor base/member initializer list e:\ylxprojects\testa\testaview.h(56) : see declaration of 'm_pFindDialogMessage'E:\YlxProjects\testa\testaView.cpp(41) : error C2065: 'FindDialogMessage' : undeclared identifierE:\YlxProjects\testa\testaView.cpp(148) : error C2065: 'FindWhatYouNeed' : undeclared identifierError executing cl.exe.testa.exe - 4 error(s), 0 warning(s)我照着那个程序弄的,是这样的选择菜单上的查找,弹出查找对话框。void CTestaView::OnFind()//创建对话框 ,没有问题,OK{ // TODO: Add your command handler code here ASSERT(m_pFindDialog == NULL); m_pFindDialog = new CFindReplaceDialog(); m_pFindDialog->Create(TRUE, "Initial Text", NULL, FR_DOWN, this);}LRESULT CTestaView::OnFindDialogMessage(WPARAM wParam, LPARAM lParam)//这个也是找那个程序改的,只不过换成了自己的类{ ASSERT(m_pFindDialog != NULL); // If the FR_DIALOGTERM flag is set, // invalidate the handle identifying the dialog box. if (m_pFindDialog->IsTerminating()) { m_pFindDialog = NULL; return 0; } // If the FR_FINDNEXT flag is set, // call the application-defined search routine // to search for the requested string. if(m_pFindDialog->FindNext()) { //read data from dialog CString FindName = m_pFindDialog->GetFindString(); bool bMatchCase = m_pFindDialog->MatchCase() == TRUE; bool bMatchWholeWord = m_pFindDialog->MatchWholeWord() == TRUE; bool bSearchDown = m_pFindDialog->SearchDown() == TRUE; //with given name do search *FindWhatYouNeed(FindName, bMatchCase, bMatchWholeWord, bSearchDown); } return 0;}带*的这句话是不是自定义函数呀,不太明白呀,就是自己怎么定义,能否举个例子另外我是这样加的这个:BEGIN_MESSAGE_MAP(CTestaView, CEditView) //{{AFX_MSG_MAP(CTestaView) ON_COMMAND(ID_FIND, OnFind)//这句是用classvizard生成创建对话框 //}}AFX_MSG_MAP 的函数自己加上去的 ON_REGISTERED_MESSAGE(m_FindDialogMessage, OnFindDialogMessage)END_MESSAGE_MAP()//主要是加的这句我是在这个构造函数里赋的初值CTestaView::CTestaView(){ // TODO: add construction code here FindDialogMessage = ::RegisterWindowMessage(FINDMSGSTRING);}另外,static const UINT m_pFindDialogMessage;这个我也定义在了CTestaView类里,但是它总是告诉我说定义找不到其他的我改的地方到是没有了。这篇文章没看太懂是不是,只要把“It is more user friendly when you remember ……”这段以上的搞懂就差不多能实现查找的功能了呢?麻烦了,:) 对了,补充一句,我是基于CEditView生成的程序,因为这个类可以打开txt类型的文件,所以我想打开一个文件,然后进行字符(串)的查找,可以做到吗?多帮忙了,初学者,:) 在显式调用动态库时,我定义的函数指针前加了CALLBACK为什么程序运行不了? 请问ATL和COM方面的不错的书籍 VC+ACCESS数据库操作中如何向一个空表添加记录? 软件在注册表里设置开机自动运行后出现严重问题!!!! 请问在知道进程ID后怎么获得其基地址? 为什么我选择CMonthCalCtrl中的日期时,得到的是另一个日期?(在线等候) 请问怎样在工具栏按钮上显示文字 为什么不能创建图像列表呢? 怎样才能弹出"打开"对话框? 如何清除CEdit中的内容??? 有人吗??? 关于 COM 的问题 各位!谁知道怎么改QQ的托盘图标呢?是改注册表还是.....?(高分喔!)
有4个错误:E:\YlxProjects\testa\testaView.cpp(26) : error C2065: 'm_FindDialogMessage' : undeclared identifier
E:\YlxProjects\testa\testaView.cpp(39) : error C2758: 'm_pFindDialogMessage' : must be initialized in constructor base/member initializer list
e:\ylxprojects\testa\testaview.h(56) : see declaration of 'm_pFindDialogMessage'
E:\YlxProjects\testa\testaView.cpp(41) : error C2065: 'FindDialogMessage' : undeclared identifier
E:\YlxProjects\testa\testaView.cpp(148) : error C2065: 'FindWhatYouNeed' : undeclared identifier
Error executing cl.exe.testa.exe - 4 error(s), 0 warning(s)
我照着那个程序弄的,是这样的选择菜单上的查找,弹出查找对话框。void CTestaView::OnFind()//创建对话框 ,没有问题,OK
{
// TODO: Add your command handler code here
ASSERT(m_pFindDialog == NULL);
m_pFindDialog = new CFindReplaceDialog();
m_pFindDialog->Create(TRUE, "Initial Text", NULL, FR_DOWN, this);}LRESULT CTestaView::OnFindDialogMessage(WPARAM wParam, LPARAM lParam)//这个也是找那个程序改的,只不过换成了自己的类
{
ASSERT(m_pFindDialog != NULL); // If the FR_DIALOGTERM flag is set,
// invalidate the handle identifying the dialog box.
if (m_pFindDialog->IsTerminating())
{
m_pFindDialog = NULL;
return 0;
} // If the FR_FINDNEXT flag is set,
// call the application-defined search routine
// to search for the requested string.
if(m_pFindDialog->FindNext())
{
//read data from dialog
CString FindName = m_pFindDialog->GetFindString();
bool bMatchCase = m_pFindDialog->MatchCase() == TRUE;
bool bMatchWholeWord = m_pFindDialog->MatchWholeWord() == TRUE;
bool bSearchDown = m_pFindDialog->SearchDown() == TRUE; //with given name do search
*FindWhatYouNeed(FindName, bMatchCase, bMatchWholeWord, bSearchDown);
} return 0;
}
带*的这句话是不是自定义函数呀,不太明白呀,就是自己怎么定义,能否举个例子另外我是这样加的这个:
BEGIN_MESSAGE_MAP(CTestaView, CEditView)
//{{AFX_MSG_MAP(CTestaView)
ON_COMMAND(ID_FIND, OnFind)//这句是用classvizard生成创建对话框
//}}AFX_MSG_MAP 的函数自己加上去的 ON_REGISTERED_MESSAGE(m_FindDialogMessage, OnFindDialogMessage)
END_MESSAGE_MAP()//主要是加的这句我是在这个构造函数里赋的初值
CTestaView::CTestaView()
{
// TODO: add construction code here
FindDialogMessage = ::RegisterWindowMessage(FINDMSGSTRING);}
另外,static const UINT m_pFindDialogMessage;这个我也定义在了CTestaView类里,但是它总是告诉我说定义找不到其他的我改的地方到是没有了。这篇文章没看太懂是不是,只要把“It is more user friendly when you remember ……”这段以上的搞懂就差不多能实现查找的功能了呢?麻烦了,:)