Upgraded code form VC6.0 to VS2005 platforma

Discussion in 'C' started by mfcnewbee, Jan 3, 2012.

  1. mfcnewbee

    mfcnewbee New Member

    Joined:
    Jan 3, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    Hello mcfnewbee. You'll probably find that MFC does not have that capability. You'd probably be better asking at a Microsoft forum.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice