[求助]那有arx的一个整个过程的添加菜单按钮示例详细讲解啊?
本帖最后由 作者 于 2006-2-16 9:48:24 编辑 <br /><br /> <P>那位高手给个详细的制作过程啊</P><P>过推荐个电子版的或实际出版的书啊?</P> void addCircleThroughMfcCom()
{
TRY
{
CAcadApplication IApp;
CAcadDocument IDoc;
CAcadModelSpace IMSpace;
IDispatch *pDisp = acedGetAcadWinApp()->
GetIDispatch(TRUE); //AddRef is called on the pointer
IApp.AttachDispatch(pDisp); // does not call AddRef()
IApp.put_Visible(true);
pDisp = IApp.get_ActiveDocument(); //AddRef is called
IDoc.AttachDispatch(pDisp);
pDisp = IDoc.get_ModelSpace(); //AddRef is called
IMSpace.AttachDispatch(pDisp);
SAFEARRAYBOUND rgsaBound;
rgsaBound.lLbound = 0L;
rgsaBound.cElements = 3;
SAFEARRAY* pStartPoint = NULL;
pStartPoint = SafeArrayCreate(VT_R8, 1, &rgsaBound);
// X value
long i = 0;
double value = 4.0;
SafeArrayPutElement(pStartPoint, &i, &value);
// Y value
i++;
value = 2.0;
SafeArrayPutElement(pStartPoint, &i, &value);
// Z value
i++;
value = 0.0;
SafeArrayPutElement(pStartPoint, &i, &value);
VARIANT pt1;
VariantInit(&pt1);
V_VT(&pt1) = VT_ARRAY | VT_R8;
V_ARRAY(&pt1) = pStartPoint;
IMSpace.AddCircle(pt1, 2.0);
VariantClear(&pt1);
// Release() is called implicitly on the local objects
}
CATCH(COleDispatchException,e)
{
e->ReportError();
e->Delete();
}
END_CATCH;
}
页:
[1]