【发布时间】:2010-07-06 11:44:55
【问题描述】:
我使用 dotnetmagic 库并创建了一个可停靠窗口,当从 IDE 运行时 (VS2005) 有效,但是当我使用可执行文件时,它会引发异常,内容如下:
System.InvalidOperationException: DragDrop registration did not succeed. --->
System.Threading.ThreadStateException: Current thread must be set to single
thread apartment (STA) mode before OLE calls can be made. Ensure that
your Main function has STAThreadAttribute marked on it.
at System.Windows.Forms.Control.SetAcceptDrops(Boolean accept)
--- End of inner exception stack trace ---
at System.Windows.Forms.Control.SetAcceptDrops(Boolean accept)
at System.Windows.Forms.Control.OnHandleCreated(EventArgs e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.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.Callback(
IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
如何剪掉这些东西,谁能帮我解决这个问题?
【问题讨论】:
-
-1,如果您阅读了异常中提供给您的非常有用的信息,您会自己解决这个问题