0 Replies Latest reply on Apr 9, 2016 5:20 AM by 克 争 孙

    How to add a treeview Activex control to PropertyManagerPage with C++

    克 争 孙

      Hi guys.

      I want to display a treeview control in  my user defined properymanagerpage, but it didnot work.I  created project used the Solidworks com non-attributed addin wizard.

      I #import "D:\Program Files\SolidWorks Corp\SOLIDWORKS\sldutils\TreeView.ocx" no_namespace, named_guids, auto_search

      and add

      HRESULT hres = S_FALSE;

        hres = swPropertyPage->IAddControl(TREEVIEW1, swControlType_ActiveX, caption, swControlAlign_LeftEdge, options, tip, &control);

        control->QueryInterface(__uuidof(IPropertyManagerPageActiveX), (void**)&activex);

        if (activex != NULL)



        activex->SetClass(L"33CD4BA8-65CB-4333-AFCC-C761E9295BF5", L"", &vbRtn);



      in CUserPropertyManagerPage::AddControls method

      I called

      void CUserPropertyManagerPage::SetActiveControl(){

        if (activex != NULL)


        CComPtr<IUnknown> pUnknown;

        HRESULT rtn = S_OK;

        rtn = activex->IGetControl(&pUnknown);

        CComQIPtr<ITreeView> treeView;

        treeView = pUnknown;


        if (treeView != NULL)


        AfxMessageBox(L"Get TreeView success");




      after the CUserPropertyManagerPage::Show


      the pUnknown always be NULL