FeatureManager C++

Nov 12, 2003 4 Replies

Hello,



I am writing a Addin for SW2003 with Visual C++ 7.



I have created a new FeatureManager design tree view with the following methods


ModelDoc2->ICreateFeatureMgrView3 ( bitmap, toolTip, whichPane, &retval )



retval->GetFeatMgrViewWnd(&handle)


The command creates a new (empty) view, but I don´t know what to do with the returned CWnd handle (long) retval. I would like to add some controls and other stuff, is this possible at all? I´m very confused. Can someone give me a hint?



Regards, Andreas


the CWnd is a regular MS Windows structure. As said on the "Add Tab in FeatureManager Design Tree Example (VB)" page in apihelp:

' Adding a custom tab to the FeatureManager Design Tree was ' previously only available to MFC-extension DLL addins and ' required a strong knowledge of MFC, Windows messaging, and ' Windows SDK. Problems were difficult to diagnose and ' fix. ' Further, the SolidWorks APIs for adding a tab to the ' FeatureManager design tree were highly MFC specific and, ' as such, were not COM-compliant.

' SolidWorks now has the ability to instantiate any

' arbitrary ActiveX control as a tab in the FeatureManager ' design tree. The new APIs are now fully COM-compliant ' and reduce the knowledge required for adding a tab.

so you'd better make an ActiveX control that does the job and place it on the FM with

ModelViewManager::CreateFeatureMgrControl

Thanks for the response. I think you are right, the Activex control is the better way. So I made an control an tried to implement it in SW. Doing this with VB was no Problem (there is an example on solidworks.com), but I can´t manage it with VC++. Here are some pieces of the code i used

#import "c:\\test.ocx" . . .

CComPtr ModDoc; CComPtr MgrView; CComPtr ModView;

iSwApp->get_IActiveDoc2(&ModDoc);

ModDoc->get_ModelViewManager(&ModView);

ModView->CreateFeatureMgrControl(icon, A2BSTR("TEST.testCtrl.1"),A2BSTR(""),A2BSTR("Tip"), swFeatMgrPaneBottom, &MgrView);

The code does .

Andreas,

Your code looks OK to me - I don't know what problem you are having.

I have put a BSD licensed sample on my downloads page (

formatting link
) that is equivalent to the SDK VB sample, but implemented in C++. Hope this helps you out.

Hello Paul

Thank you very much!!! This is a very good example and it helped me to solve the problem. Something with the picture stuff was wrong.

bye

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required