3 Replies Latest reply on May 29, 2015 12:18 PM by Simon Turner

    eDrawings viewer automation in C++  hangs on OpenDoc

    Lee Midgley

      Hi,

       

      With below in C++ it creates the object ok and can get the eDrawings version fine from within the code, but as soon as it tries to opens the edrw file nothing happens at all - just stops without any errors.  any ideas?

       

      #include "emodelview.h"   // this is created from a class type library import from the EModelView.dll

       

       

      void CTestedrwDlg::OnButton1()

      {

        CoInitialize(NULL);

        IEModelViewControl e;

       

        // Get the IDispatch pointer and attach it to the objWord object.

        if (!e.CreateDispatch("EModelView.EModelViewControl"))

        {

        AfxMessageBox("Couldn't get object");

        return;

        }

       

        CString v = e.GetVersion();

        AfxMessageBox(v);

       

        try

        {

        e.OpenDoc(_T("c:\\test.edrw"), false, false, false, _T(""));

        AfxMessageBox("open ok");

        e.Print5(false, _T("test"), false, false, true, 1, 0, 0, 0, true, 0, 0, _T(""));

        AfxMessageBox("print ok");

        }

        catch(...)

        {

        AfxMessageBox("error");

        }

      }