
I inherited from the DocumentWindow class to create my own class 'Page'.
When I call Activate on the Page object from a COM object's message handler, I get the following error.I need to get a value from the COM and load a document window based on that value.
I already have [STAThread] specified in Main.
I works without any issues when I call activate outside of the COM message handler.
How do I fix this issue? Please help!
Thanks!
When I call Activate on the Page object from a COM object's message handler, I get the following error.
A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
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.set_AllowDrop(Boolean value)
at ActiproSoftware.UIStudio.Dock.TabbedMdiContainer..ctor(DockManager dockManager)
at ActiproSoftware.UIStudio.Dock.DockManager.b(TabbedMdiWindow A_0)
at ActiproSoftware.UIStudio.Dock.DocumentWindow.Activate(Boolean focus)
at ActiproSoftware.UIStudio.Dock.TabbedMdiWindow.Activate()
at ClickTrader.Layout.AddPage(Page p) in C:\Documents and Settings\mkuruvil\My Documents\Visual Studio 2005\Projects\ClickTrader\ClickTrader\Layout.cs:line 90
at ClickTrader.Layout..ctor(DockManager dM, String layoutFile) in C:\Documents and Settings\mkuruvil\My Documents\Visual Studio 2005\Projects\ClickTrader\ClickTrader\Layout.cs:line 55
at ClickTrader.ClickTrader.objConfig_OnAttribute(String strAttributeName, String strAttributeValue) in C:\Documents and Settings\mkuruvil\My Documents\Visual Studio 2005\Projects\ClickTrader\ClickTrader\ClickTrader.cs:line 148
I already have [STAThread] specified in Main.
I works without any issues when I call activate outside of the COM message handler.
How do I fix this issue? Please help!
Thanks!