If the Form is modal, this will not work.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010
http://www.acadxtabs.com
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");
wrote in message news:6339505@discussion.autodesk.com...
I'm getting the same error. This line was working until I loaded
dwgthumbnails.ocx Dim dwg As Document =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.Open(listOfFiles(cnt),
True) It works if I put it in my Command Subroutine. But if I put in into a form
it crashes. I'm using AutoCAD 2008 I took out the references to DwgThumbNails
but It still crashes System.Runtime.InteropServices.COMException was unhandled
by user code ErrorCode=-2145386295 HelpLink="C:\Program Files\AutoCAD
2008\HELP\OLE_ERR.CHM#-2145386295" Message="Invalid execution context"
Source="AutoCAD" StackTrace: at
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
errorCode, IntPtr errorInfo) at
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) at
Autodesk.AutoCAD.ApplicationServices.DocumentCollection.Open(String fileName,
Boolean forReadOnly, String password) at
Autodesk.AutoCAD.ApplicationServices.DocumentCollection.Open(String fileName,
Boolean forReadOnly) at BatchPlot_AMSTS.Plot_Dialog.Plot_Click(Object sender,
EventArgs e) in C:\Documents and Settings\amasutti\My Documents\Visual Studio
2008\Projects\VbMgdAcad3\VbMgdAcad3\Plot_Dialog.vb:line 87 at
System.Windows.Forms.Control.OnClick(EventArgs e) at
System.Windows.Forms.Button.OnClick(EventArgs e) at
System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at
System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32
clicks) at System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.ButtonBase.WndProc(Message& m) at
System.Windows.Forms.Button.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at
System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData) at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context) at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context) at System.Windows.Forms.Application.RunDialog(Form
form) at System.Windows.Forms.Form.ShowDialog(IWin32Window owner) at
Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(IWin32Window
owner, Form formToShow, Boolean persistSizeAndPosition) at
Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(Form
formToShow) at BatchPlot_AMSTS.AMSTSCommands.PlotCurrentLayout() in C:\Documents
and Settings\amasutti\My Documents\Visual Studio
2008\Projects\VbMgdAcad3\VbMgdAcad3\Commands5.vb:line 425 at
AcMgCommandClass.InvokeWorker(AcMgCommandClass* , MethodInfo mi, Object
commandObject, Boolean bLispFunction) at
AcMgCommandClass.InvokeWorkerWithExceptionFilter(AcMgCommandClass* , MethodInfo
mi, Object commandObject, Boolean bLispFunction) at
AcMgPerDocumentCommandClass.Invoke(AcMgPerDocumentCommandClass* , gcroot* mi,
Boolean bLispFunction) at AcMgCommandClass.CommandThunk.Invoke(CommandThunk* )
InnerException: Thanks in advance.