Names of views programatically

Top  Previous  Next

Although AddBaseView has a name parameter, it is not clear to me what it means. In fact it never changes the name of the view, to do that you need to follow this code fragment:

 

    {

           CComPtr<DrawingView> pBaseView1 ...

        ...

        CComBSTR bstrViewName ;

        pBaseView1->get_Name (&bstrViewName) ;

        TRACE (L"Base view name was = <%s>\n",bstrViewName) ;

 

        bstrViewName = L"SideView"  ;

        pBaseView1->put_Name (bstrViewName) ;

 

        pBaseView1->get_Name (&bstrViewName) ;

        TRACE (L"Base view name now = <%s>\n",bstrViewName) ;

    }

 

So just use put_Name to change the name of the view.

 

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)