Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Upgraded code form VC6.0 to VS2005 platforma (http://www.go4expert.com/forums/upgraded-code-form-vc60-vs2005-platforma-t27520/)

mfcnewbee 3Jan2012 13:06

Upgraded code form VC6.0 to VS2005 platforma
 
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

xpi0t0s 4Jan2012 16:31

Re: Upgraded code form VC6.0 to VS2005 platforma
 
Hello mcfnewbee. You'll probably find that MFC does not have that capability. You'd probably be better asking at a Microsoft forum.


All times are GMT +5.5. The time now is 08:20.