1 Reply Latest reply on Apr 18, 2016 9:16 PM by Artem Taturevych

    Issues with OpenDoc6

    Eg Gloo

      Hi

       

      I'm trying to open a part file in VC++ 6. Here's what I have at the moment:

       

      if (SUCCEEDED(swApp.CoCreateInstance(__uuidof(SldWorks), NULL, CLSCTX_LOCAL_SERVER)))
      {
           swApp->put_Visible(TRUE);
           BSTR filename = bstr_t("W:\\models\\Rod.SLDPRT");
           long err = 0;
           long warn = 0;
           ModelDoc2 swModel = swApp->OpenDoc6(filename, (int)swDocPART, (int)swOpenDocOptions_Silent, bstr_t(""), &err, &warn);
      }
      

       

      I'm having issues on line 07 where I get an error saying "Incomplete type is not allowed". Does anyone know what might be wrong there?

       

      Any help would be much appreciated.

        • Re: Issues with OpenDoc6
          Artem Taturevych

          Hi,

           

          The OpenDoc6 returns the pointer as the last parameter (IModelDoc2**) and HRESULT as the function result. So something like this would work if your are using ATL or otherwise you can use IModelDoc2** instead of smart pointer CComPtr<IModelDoc2>:

           

          CComPtr<IModelDoc2> pModel;

          swApp->OpenDoc6(filename, swDocPART, swOpenDocOptions_Silent, L"", &err, &warn, &pModel);

          Looks like you are trying to use c++ in C# .NET manner. You might better switch to c#.

           

          Thanks,

          Artem