Search Kean's blog for 'IMessageFilter'.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011
http://www.acadxtabs.com
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");
wrote in message news:6400307@discussion.autodesk.com...
I use the following code to initialize Autocad (Civil3d) application:
{code}
static void Main(string[] args)
{
try
{
//initializing application
Autodesk.AutoCAD.Interop.AcadApplication acad = null;
try
{
acad =
(Autodesk.AutoCAD.Interop.AcadApplication)Marshal.GetActiveObject("AutoCAD.Application.18.1");
}
catch (System.Exception ex)
{
//not started yet? start a new one
acad = new Autodesk.AutoCAD.Interop.AcadApplication();
}
acad.Visible = true;
//no documents open? open a new document
if (acad.Documents.Count == 0)
{
acad.Documents.Add("");
}
}
catch (System.Exception ex)
{
string msg = "Fail: " + ex.Message;
System.Diagnostics.Trace.WriteLine(msg);
}
}
{code}
If the application isn't running yet, instead of get it started I get error "The
message filter indicated that the application is busy. (Exception from HRESULT:
0x8001010A (RPC_E_SERVERCALL_RETRYLATER))".
The same code (with different type string of course) for Civil3d 2009 usually
works normally. Sometimes if the Civil3d 2009 starts for the first time, the
starting time exceeds timeout (120 seconds), and the program also fails, but at
least I have known reason here.