咖迷社区(CAXA数码大方)

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 4407|回复: 0

CAXA工艺图表2011二次开发

[复制链接]

1

主题

1

帖子

64

积分

注册会员

Rank: 2

积分
64
发表于 2020-5-4 20:43:51 | 显示全部楼层 |阅读模式
我在对CAXA工艺图表2011进行二次开发,参考你之前贴子中的代码:        HRESULT hRet;
        CLSID clsid;
        ICAPPInfo *pInterface = NULL;
        ICAPPXmlInfo *pXmlInterface = NULL;
        hRet = ::CLSIDFromProgID(L"CAXAInfo.CAPPInfo", &clsid);
        if (FAILED(hRet))
                return;
        hRet = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(ICAPPInfo), (void **)&pInterface);
        if (FAILED(hRet));
    LPDISPATCH lpDisp=NULL;
        COleVariant covOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR);   
        CString CappFileName = L"E:\\30DevSupport\\55CAXA\\ObjectCRX_Samples\\model\\test.CXP";
        CString TxtXmlFileName= L"test.txt";
        CString filePassword= L"";
        CString cardName=L"模壳-工艺过程卡";
        CString colName = L"工序内容";
        CString sTemp=colName+L"^"+L"HFHZ";
        CString sExtFilter = L"txt";
        VARIANT_BOOL ret;
        BSTR BstrEbFileName,BstrTxtXmlFileName,bstrpassword,bstrColInfo,bstrCardName;
        int iCardMask = 1|2|4|8|16;

        BstrEbFileName=CappFileName.AllocSysString();
        BstrTxtXmlFileName=TxtXmlFileName.AllocSysString();
        bstrpassword= filePassword.AllocSysString();
        bstrColInfo = sTemp.AllocSysString();
        bstrCardName = cardName.AllocSysString();
        //hRet = pInterface->raw_GetCappInfoToTxt(BstrEbFileName,BstrTxtXmlFileName,&ret);
        BSTR strCommonAtt;
        //hRet = pInterface->raw_GetCardCommonAttrib(BstrEbFileName,&strCommonAtt,&ret);
        if(sExtFilter == "xml")
        {
          pXmlInterface =(ICAPPXmlInfo*) pInterface;
          BSTR strTemplateSetName;
          hRet = pXmlInterface->raw_GetTemplateSetNameForCxpFile(BstrEbFileName,&strTemplateSetName);
          hRet=pXmlInterface->raw_InfoToXmlFile(BstrEbFileName,iCardMask,BstrTxtXmlFileName,&ret);
          pXmlInterface = NULL;
        }
        else
        {
          pXmlInterface =(ICAPPXmlInfo*) pInterface;
          BSTR strTemplateSetName;
          hRet = pXmlInterface->raw_GetTemplateSetNameForCxpFile(BstrEbFileName,&strTemplateSetName);
          //hRet=pXmlInterface->raw_InfoToTxtFile(BstrEbFileName,BstrTxtXmlFileName,&ret);
          hRet=pXmlInterface->raw_OpenFile(BstrEbFileName,bstrpassword);

          hRet = pXmlInterface->raw_WriteTxtInfoToCard(bstrCardName,bstrColInfo,5,&ret);
          hRet=pXmlInterface->raw_CloseFile();
          pXmlInterface = NULL;
        }
        //hRet = pInterface->raw_GetCappInfoToTxt(BstrEbFileName,BstrTxtXmlFileName,&ret);

        if(FAILED(hRet))
        {
          ::SysFreeString(BstrEbFileName);
          ::SysFreeString(BstrTxtXmlFileName);
          //HandError(pInterface,IID_ICAPPInfo);
          pInterface->Release();
          return;
        }
        ::SysFreeString(BstrEbFileName);
        ::SysFreeString(BstrTxtXmlFileName);

        pInterface->Release();
但是调试发现raw_InfoToTxtFile和raw_OpenFile始终返回S_FALSE,同时功能也没有实现。请教一下是怎么回事?不胜感激!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|咖迷社区(CAXA数码大方) ( 京ICP备05001831号-1 )

GMT+8, 2024-3-29 19:18 , Processed in 0.171691 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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