hi, I wanted to host a WPF user control in my QT application. So I created a CLI dll that returns the HWND of the user control. It creates an HwndSource for the WPF control and returns the handle of that HWND source.
I added reference to this CLI dll from my QT application and tried to get the HWND. But I am getting an error as given below. Unhandled Exception: System.InvalidOperationException: The calling thread must be STA, because many UI components require this. at System.Windows.Input.InputManager..ctor() at System.Windows.Input.InputManager.GetCurrentInputManagerImpl() at System.Windows.Interop.HwndMouseInputProvider..ctor(HwndSource source) at System.Windows.Interop.HwndSource.Initialize(HwndSourceParameters parameters) at System.Windows.Interop.HwndSource..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent) at GetWPFHwnd(HWND__* parent, Int32 x, Int32 y, Int32 width, Int32 height) in c:\users\ing08746\desktop\qt\staticclilib\staticclilib\staticclilib.cpp:line 42 at WinMainCRTStartup() I think we need to set the ApartmentState of QT application as STA. How can set the apartment state to STA for QT application? with regards, prasad
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest