Hi, I'm trying to run the fallowing code:
Type pia_type = Type.GetTypeFromProgID("CorelDRAW.Application.18");Corel.Interop.VGCore.Application corelApp = Activator.CreateInstance(pia_type) as Corel.Interop.VGCore.Application;corelApp.Visible = false;
// Thread.Sleep(5000);
Corel.Interop.VGCore.Document doc = corelApp.OpenDocument(copiedFilePath);
......
The OpenDocument line fails, because the Corel is not yet fully started to perform next actions. And it works if I uncomment Thread.Sleep line, because it has more time to load. Clearly Thread.Sleep is not a good solution, because some computers might load faster, some slower and I can't guess the milis needed. I tried different Events (WindowActivate, OnApplicationEvent), but with "corelApp.Visible = false;" I was not lucky to catch a "nowItsLoaded" event.
Any ideas?