Need simple steps to port vc++6.0 to vc++2005 express

Answered Need simple steps to port vc++6.0 to vc++2005 express

  • Thursday, December 29, 2005 3:51 AM
     
     

    here are the vc++6.0 codes from a graphic training book:

    MainFrm.h and MainFrm.cpp:

    // MainFrm.h : interface of the CMainFrame class
    //
    /////////////////////////////////////////////////////////////////////////////

    #if !defined(AFX_MAINFRM_H__58CBEE29_854F_11D8_B394_00E04C391319__INCLUDED_)
    #define AFX_MAINFRM_H__58CBEE29_854F_11D8_B394_00E04C391319__INCLUDED_

    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000

    class CMainFrame : public CFrameWnd
    {
     
    protected: // create from serialization only
     CMainFrame();
     DECLARE_DYNCREATE(CMainFrame)

    // Attributes
    public:

    // Operations
    public:

    // Overrides
     // ClassWizard generated virtual function overrides
     //{{AFX_VIRTUAL(CMainFrame)
     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
     //}}AFX_VIRTUAL

    // Implementation
    public:
     virtual ~CMainFrame();
    #ifdef _DEBUG
     virtual void AssertValid() const;
     virtual void Dump(CDumpContext& dc) const;
    #endif

    protected:  // control bar embedded members
     CStatusBar  m_wndStatusBar;
     CToolBar    m_wndToolBar;

    // Generated message map functions
    protected:
     //{{AFX_MSG(CMainFrame)
     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
     afx_msg void OnidLineWidth();
     afx_msg void OnidCurColor();
     afx_msg void OnBresehamCircle();
     //}}AFX_MSG
     DECLARE_MESSAGE_MAP()
    };

    /////////////////////////////////////////////////////////////////////////////

    //{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.

    #endif // !defined(AFX_MAINFRM_H__58CBEE29_854F_11D8_B394_00E04C391319__INCLUDED_)

    // MainFrm.cpp : implementation of the CMainFrame class
    //

    #include "stdafx.h"
    #include "GraphicsAlgorithm.h"

    #include "MainFrm.h"

    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif

    /////////////////////////////////////////////////////////////////////////////
    // CMainFrame

    IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

    BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
     //{{AFX_MSG_MAP(CMainFrame)
     ON_WM_CREATE()
     ON_COMMAND(idLineWidth, OnidLineWidth)
     ON_COMMAND(idCurColor, OnidCurColor)
     ON_COMMAND(IDM_Breseham_Circle, OnBresehamCircle)
     //}}AFX_MSG_MAP
    END_MESSAGE_MAP()

    static UINT indicators[] =
    {
     ID_SEPARATOR,           // status line indicator
     ID_INDICATOR_CAPS,
     ID_INDICATOR_NUM,
     ID_INDICATOR_SCRL,
    };

    /////////////////////////////////////////////////////////////////////////////
    // CMainFrame construction/destruction

    CMainFrame::CMainFrame()
    {
     // TODO: add member initialization code here
     
    }

    CMainFrame::~CMainFrame()
    {
    }

    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
      return -1;
     
     if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
      | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
      !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
     {
      TRACE0("Failed to create toolbar\n");
      return -1;      // fail to create
     }

     if (!m_wndStatusBar.Create(this) ||
      !m_wndStatusBar.SetIndicators(indicators,
        sizeof(indicators)/sizeof(UINT)))
     {
      TRACE0("Failed to create status bar\n");
      return -1;      // fail to create
     }

     // TODO: Delete these three lines if you don't want the toolbar to
     //  be dockable
     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
     EnableDocking(CBRS_ALIGN_ANY);
     DockControlBar(&m_wndToolBar);

     return 0;
    }

    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
     if( !CFrameWnd::PreCreateWindow(cs) )
      return FALSE;
     // TODO: Modify the Window class or styles here by modifying
     //  the CREATESTRUCT cs

     return TRUE;
    }

    /////////////////////////////////////////////////////////////////////////////
    // CMainFrame diagnostics

    #ifdef _DEBUG
    void CMainFrame::AssertValid() const
    {
     CFrameWnd::AssertValid();
    }

    void CMainFrame::Dump(CDumpContext& dc) const
    {
     CFrameWnd::Dump(dc);
    }

    #endif //_DEBUG

    /////////////////////////////////////////////////////////////////////////////
    // CMainFrame message handlers


    void CMainFrame::OnidLineWidth()
    {
     // TODO: Add your command handler code here
     
    }

    void CMainFrame::OnidCurColor()
    {
     // TODO: Add your command handler code here
     
    }

    void CMainFrame::OnBresehamCircle()
    {
     // TODO: Add your command handler code here
     
    }

    LWidth.h and LWidth.cpp:

    #if !defined(AFX_LWIDTH_H__B8FCCAA1_8714_11D8_B394_00E04C391319__INCLUDED_)
    #define AFX_LWIDTH_H__B8FCCAA1_8714_11D8_B394_00E04C391319__INCLUDED_

    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    // LWidth.h : header file
    //

    /////////////////////////////////////////////////////////////////////////////
    // LWidth dialog

    class LWidth : public CDialog
    {
    // Construction
    public:
     LWidth(CWnd* pParent = NULL);   // standard constructor

    // Dialog Data
     //{{AFX_DATA(LWidth)
     enum { IDD = IDD_DIALOG1 };
     int  m_LWidth;
     //}}AFX_DATA


    // Overrides
     // ClassWizard generated virtual function overrides
     //{{AFX_VIRTUAL(LWidth)
     protected:
     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
     //}}AFX_VIRTUAL

    // Implementation
    protected:

     // Generated message map functions
     //{{AFX_MSG(LWidth)
      // NOTE: the ClassWizard will add member functions here
     //}}AFX_MSG
     DECLARE_MESSAGE_MAP()
    };

    //{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.

    #endif // !defined(AFX_LWIDTH_H__B8FCCAA1_8714_11D8_B394_00E04C391319__INCLUDED_)

    // LWidth.cpp : implementation file
    //

    #include "stdafx.h"
    #include "GraphicsAlgorithm.h"
    #include "LWidth.h"

    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif

    /////////////////////////////////////////////////////////////////////////////
    // LWidth dialog


    LWidth::LWidth(CWnd* pParent /*=NULL*/)
     : CDialog(LWidth::IDD, pParent)
    {
     //{{AFX_DATA_INIT(LWidth)
     m_LWidth = 3;
     //}}AFX_DATA_INIT
    }


    void LWidth::DoDataExchange(CDataExchange* pDX)
    {
     CDialog::DoDataExchange(pDX);
     //{{AFX_DATA_MAP(LWidth)
     DDX_Text(pDX, IDC_EDIT1, m_LWidth);
     DDV_MinMaxInt(pDX, m_LWidth, 0, 100);
     //}}AFX_DATA_MAP
    }


    BEGIN_MESSAGE_MAP(LWidth, CDialog)
     //{{AFX_MSG_MAP(LWidth)
      // NOTE: the ClassWizard will add message map macros here
     //}}AFX_MSG_MAP
    END_MESSAGE_MAP()

    /////////////////////////////////////////////////////////////////////////////
    // LWidth message handlers

    ==============================================

    Thanks in advance.

     

     

All Replies

  • Thursday, December 29, 2005 7:42 AM
    Moderator
     
     Answered

    You can not port a MFC program to Visual C++ 2005 Express!

    The Express version does not cotain the ATL and MFC library. You need at least VS 2005 Standard!