几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   SolidWorks二次开发 (http://www.dimcax.com/hust/forumdisplay.php?f=111)
-   -   there are three terrible questions on SW translator as below (http://www.dimcax.com/hust/showthread.php?t=1403)

huangyhg 2007-09-04 12:50 PM

there are three terrible questions on SW translator as below
 
【隐藏帖】

huangyhg 2007-09-04 12:51 PM

回复: there are three terrible questions on SW translator as below
 
Hello Yanhua,

To answer your questions:

1 - You should be able to use ::GetActiveObject to obtain the currently running SW session. Once you have the IUnknown pointer, you can use the AttachDispatch to attach it to your ISldWorks object.

2 - I believe that I have responded to this item separately today.

3 - If you look at the three calls: OpenDoc6, ActivateDoc2 and GetActiveDoc all three of them are returning a document object. Thus, you only need one of them. It is true that the macro recorder records all three, but you do not need to make these calls when working with your code.


Regards,
Earl Hasz

huangyhg 2007-09-04 01:37 PM

回复: there are three terrible questions on SW translator as below
 
Hi,

Thanks.But this is not useful for the first question.

My programming language is Visual C++7.0, and I use OLE Automation of SolidWorks 2006, not COM.

My question is that how to connect to an already running instance of SW in my following scene.

Scene:

VC7.0 & OLE Automation &SolidWorks 2006 & swdisp.h

yanhua

huangyhg 2007-09-04 01:38 PM

回复: there are three terrible questions on SW translator as below
 
Hello Yanhua,
Based on my last response, you should be able to do the following:
IDispatch *pDisp;
CoGetObject(L”SldWorks.Application”, NULL, __uuidof(IDispatch), (void**)&pDisp);
ISldWorks swApp(pDisp);
Regards,

-Earl


所有的时间均为北京时间。 现在的时间是 08:10 AM.