标题:按照一参考书写的有关多线程程序,请各位看看改正错误。
只看楼主
河边
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-8-6
 问题点数:0 回复次数:1 
按照一参考书写的有关多线程程序,请各位看看改正错误。

以下是部分代码
// CBounceview.cpp
……
LRESULT OnDelegatedCmdMsg(WPARAM,LPARAM Iparam)
{
COnCmdMsg *pOnCmdMsg=(COnCmdMsg *)Iparam;
return CWnd::OnCmdMsg(pOnCmdMsg->m_nID,pOnCmdMsg->m_nCode,pOnCmdMsg->m_pExtra,pOnCmdMsg-

>m_pHandlerInfo);//此处有错误,详见错误信息,其中declaration of 'OnCmdMsg' 为
//virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)

}
LRESULT OnPrepareToClose(WPARAM mParam=0,LPARAM IParam=0)
{
DestroyWindow();//此处有错误,详见错误信息
return 0;
}
……
// CBounceFrame.cpp
BOOL CBounceFrame::Creat(LPCTSTR szTitle,LONG style,const RECT& rect,CMDIFrameWnd* pParent)
{
if(menu.m_hMenu==NULL)
menu.LoadMenu(IDR_BOUNCETYPE);
m_hMenuShared=menu.m_hMenu;
if(!CMDIChildWnd::Create(NULL,szTitle,style,rect,pParent))
return FALSE;
CBounceThread *pBounceThread=new CBounceThread(m_hWnd);//此处有错误,详见错误信息,其中

//declaration of 'new':void* PASCAL operator new(size_t nSize, LPCSTR lpszFileName, int nLine)
pBounceThread->CreateThread();

return TRUE;
}
……
错误信息:
……
C:\Documents and Settings\Administrator\桌面\MyProjects\MThread\BounceFrame.cpp(47) : warning C4291:

'void *__stdcall CObject::operator new(unsigned int,const char *,int)' : no matching operator delete

found; memory will not be freed if initializati
on throws an exception
g:\软件\vc文件\vc6cn\vc98\mfc\include\afx.h(683) : see declaration of 'new'
BounceThread.cpp
C:\Documents and Settings\Administrator\桌面\MyProjects\MThread\BounceThread.cpp(18) : warning

C4291: 'void *__stdcall CObject::operator new(unsigned int,const char *,int)' : no matching operator

delete found; memory will not be freed if initializat
ion throws an exception
g:\软件\vc文件\vc6cn\vc98\mfc\include\afx.h(683) : see declaration of 'new'
Bounceview.cpp
C:\Documents and Settings\Administrator\桌面\MyProjects\MThread\Bounceview.cpp(187) : error C2352:

'CCmdTarget::OnCmdMsg' : illegal call of non-static member function
g:\软件\vc文件\vc6cn\vc98\mfc\include\afxwin.h(1595) : see declaration of 'OnCmdMsg'
C:\Documents and Settings\Administrator\桌面\MyProjects\MThread\Bounceview.cpp(192) : error C2660:

'DestroyWindow' : function does not take 0 parameters

执行 cl.exe 时出错.
Creating browse info file...

MThread.exe - 1 error(s), 0 warning(s)

知道原因的请帮我改正,谢谢阅读!,多谢赐教!

搜索更多相关主题的帖子: 线程 pOnCmdMsg 书写 Iparam 
2007-04-08 19:43
河边
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-8-6
得分:0 

我是按照参考书上的,没有改动的,可怎么就有问题了呢?

2007-04-10 11:56



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-130193-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.054918 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved