几何尺寸与公差论坛

 找回密码
 注册
查看: 2516|回复: 1

How to release ISldWorks via OLE automation?

[复制链接]
发表于 2007-9-3 23:49:12 | 显示全部楼层 |阅读模式
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;
 楼主| 发表于 2007-9-3 23:49:41 | 显示全部楼层

回复: 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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-22 18:44 , Processed in 0.036571 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表