几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   How to release ISldWorks via OLE automation? (http://www.dimcax.com/hust/showthread.php?t=1396)

huangyhg 2007-09-03 11:49 PM

How to release ISldWorks via OLE automation?
 
ow to release ISldWorks via OLE automation?

It maybe has some problems when I close the SolidWorks session via the following code.

My code as follows:

// code 2 start

ISldWorks m_pSldWorks;

// connects to an already running instance of SW

//?????????????

// or will start SW if not already running

m_pSldWorks.CreateDispatch(_T("SldWorks.Application"));

//???????

// close the SolidWorks session

m_pSldWorks.ExitApp ();

m_pSldWorks.DetachDispatch();

m_pSldWorks.ReleaseDispatch();

m_pSldWorks.m_lpDispatch = NULL;

huangyhg 2007-09-03 11:49 PM

回复: How to release ISldWorks via OLE automation?
 
Hello Yanhua,

You should be able to simply use the ReleaseDispatch call when you are done with it. A call to ExitApp is required beforehand if you are looking to close SW. Stepping into ReleaseDispatch should show you what it is doing.


Regards,
Earl Hasz


所有的时间均为北京时间。 现在的时间是 02:43 PM.