几何尺寸与公差论坛

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

Earl,how to resolve the error as "Unable to read write-only property

[复制链接]
发表于 2007-5-20 09:47:46 | 显示全部楼层 |阅读模式
Q:
Subject: Earl,how to resolve the error as "Unable to read write-only property"? SR:1-407938223


Dear,

Thanks.

But, I get an error as “Unable to read write-only property” when add a call to body.EnumFaces. How to resolve the error?

My code as fllows:

LPUNKNOWN pFaces = NULL;

      pFaces = swBody.EnumFaces();

      LPDISPATCH *dFaces = NULL;

      pFaces->QueryInterface(IID_IDispatch, (LPVOID*)&dFaces);

Sence:

SW API OLE & VC++

Yogy
 楼主| 发表于 2007-5-20 09:48:09 | 显示全部楼层

回复: Earl,how to resolve the error as "Unable to read write-only pr

R:
Hello,

Ah.  It looks like you are using the older swdisp.h and swdisp.cpp interfaces for SW.  In that case, you might look at using:



#import “sldworks.tlb” raw_interfaces_only



LPDISPATCH pDisp = swBody;

SldWorks::IBody2 *comBody;

pDisp->QueryInterface(__uuidof(SldWorks::IBody2), (LPVOID*)&comBody);



SldWorks::IEnumFaces2 *comEnumFaces;

comBody->get_IEnumFaces(&comEnumFaces);

// … do your work…



This will allow you to get to the COM version of the object and work with it directly.  Be sure to call the object’s Release() method when done with each object.





Regards,

-Earl
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-22 19:15 , Processed in 0.036397 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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