将代码从VC6.0升级到VS2005 platforma,并在CPreviewView类中崩溃. [英] Upgraded code form VC6.0 to VS2005 platforma and getting crash in CPreviewView class.

查看:74
本文介绍了将代码从VC6.0升级到VS2005 platforma,并在CPreviewView类中崩溃.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我已将代码从vc6.0升级到vs2005.消除所有编译器错误后,我运行了代码,发现某些功能中断,如打印预览.我调试了代码,发现在vc6版本中,viewprev.cpp平台文件正在使用
CFrameWnd * pParent = STATIC_DOWNCAST(CFrameWnd,AfxGetMainWnd());
ASSERT_VALID(pParent);
获取父对象,并且在vs2005中,viewprev.cpp使用的是
CWnd * pMainWnd = GetParentFrame();
如果(DYNAMIC_DOWNCAST(CFrameWnd,pMainWnd)== NULL)
{
//如果不是框架,我们将尝试主窗口
pMainWnd = AfxGetMainWnd();
}

CFrameWnd * pParent = STATIC_DOWNCAST(CFrameWnd,pMainWnd);
ASSERT_VALID(pParent);
得到父母.我以为这比我破坏了功能
CWnd * pMainWnd = AfxGetMainWnd();
this-> SetParent(pMainWnd);
达到相同的效果,并且有效.但是这样做之后,我得到了没有工具栏的打印预览(在vc6中存在).当我关闭它时,它崩溃了.
谁能解释我的原因并回答为什么我没有工具栏,为什么它崩溃或解决问题的原因?

问候

Hi All,
I have upgraded code from vc6.0 to vs 2005. After removing all the compiler error i ran the code and found some breaking of the functionality like print preview. I debugged the code and found out that in vc6 version viewprev.cpp platform file was using
CFrameWnd* pParent = STATIC_DOWNCAST(CFrameWnd, AfxGetMainWnd());
ASSERT_VALID(pParent);
to get the parent and in vs2005 viewprev.cpp is using
CWnd* pMainWnd = GetParentFrame();
if (DYNAMIC_DOWNCAST(CFrameWnd, pMainWnd) == NULL)
{
// if it''s not a frame, we''ll try the main window
pMainWnd = AfxGetMainWnd();
}

CFrameWnd* pParent = STATIC_DOWNCAST(CFrameWnd, pMainWnd);
ASSERT_VALID(pParent);
to get the parent. I thought this was breaking the functionality than i did
CWnd* pMainWnd = AfxGetMainWnd();
this->SetParent(pMainWnd);
to achieve the same effect and it worked. but after doing this i was getting the print preview with no toolbar(which was present in vc6). And it is crashing when i close it.
Can anybody explain me the reason and answer why i am not getting the toolbar and why it is crashing or the soln to solve the problem?

regards

推荐答案

您应该显示一些代码.

我希望您已将所有使用过的dll升级到VS 2005.
you shoul show some of the code.

I hope you have upgraded all used dll to VS 2005.


这篇关于将代码从VC6.0升级到VS2005 platforma,并在CPreviewView类中崩溃.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆