Working with C++ environment

There are several ways in which a C++ client can work with the ActiveX controls. This document describes just one way of using the TerraDevelopr from within a simple ATL dialog application.

 

  1. Derive your dialog from the ATL template class CAxDialogImpl.
    This allows your dialog to host ActiveX controls, such as the 3D window, the Information Window, and the navigation map.

    Your dialog class should look something like this:
     
    class CMyDialog :
                  public CAxDialogImpl<CMyDialog>
    {
    public:

      :
      :
      :

    };

    You can use the Visual C++ “insertàNew ATL Object…” menu option to create your dialog. Select the “Dialog” object from the “Miscellaneous” category.

  2. Add the 3D Window, Information Windows and Navigation Map to your project.
    Add the following members to your dialog class definition:

    CAxWindow m_wnd3D;
    CAxWindow m_wndInfoTree;
    CAxWindow m_wndNavMap;

    CAxWindow is an ATL class that can be used to encapsulate ActiveX controls.
    Add the following lines to your dialog OnInitDialog handler:

    LPCTSTR pszTE3DName = _T("TerraExplorerX.TE3DWindow");
    RECT rect1 = { 10, 10, 350, 250 };
    m_wnd3D.Create(m_hWnd, rect1, pszTE3DName, WS_CHILD | WS_VISIBLE);


    LPCTSTR pszTEInformationName = _T("TerraExplorerX.TEInformationWindow");
    RECT rect2 = { 400, 10, 550, 250 };
    m_wndInfoTree.Create(m_hWnd, rect2, pszTEInformationName, WS_CHILD | WS_VISIBLE);
     
    LPCTSTR pszTENavigationName = _T("TerraExplorerX.TENavigationMap");
    RECT rect3 = { 500, 10, 650, 250};
    m_wndInfoTree.Create(m_hWnd, rect3,pszTENavigationName, WS_CHILD | WS_VISIBLE);

    The first three lines create the 3D window control, the next three lines create the Information Window control and the last three lines create the Navigation Map.

    At this point, if you compile and run your project, you should see that your dialog contains the 3D window, Information Window and Navigation Map (You can even start working by clicking on the 3D window and pressing Ctrl+O to open a fly file).