8 Replies Latest reply: Dec 8, 2011 7:33 AM by A.Non RSS

    OLE to load a .MCD file

    ptc-4348743 Copper

      Our customer gave us an MCD file and wants us to be able to run it via a C++ interface. Running/Linking an automation interface is something we do a lot of, so no biggie there. BUT. This code throws an exception when trying to load the MCD file: (Sorry for he TABLE format. I cannot seem to get it to allow pasting code normally)

       


      IMathcadApplication* McApp;

      IMathcadWorksheets* McWorksheets;

      IMathcadWorksheet* McWorksheet;

      CoInitialize(NULL);// Initialize the COM library

      HRESULT hr=CoCreateInstance(CLSID_App, NULL,








      CLSCTX_LOCAL_SERVER,








      IID_IMathcadApplication,








      (LPVOID*)&McApp);

      if (!SUCCEEDED(hr)) {


      MessageDlg("Unable to create a MathCad Application object",mtError, TMsgDlgButtons() << mbOK, 0);


      return ;

      }

      McApp->Visible=true;

      McWorksheets=McApp->Worksheets;

      McWorksheet=McWorksheets->Open(L"c:\\KVD_FILE.mcd");

      McApp->Release();

       

       

      Everything works fine until the Open command. Can someone point me to examples of VB, Java, or C++ code that shows how to load a MCD file? And if it is in the callaboratory, can some PLEASE tell me how to get to it. I have never found the callaboratory.

       

      Thanks, Brian