PDA

View Full Version : Capture Qt application within Win32 MFC application



QtUser2012
11th September 2012, 09:57
I have a simple Qt application, designed with Qt-Designer, consists of two PushButtons and one ComboBox which should be integrated into a Win32 application by capturing the Qt application.

Codesnippet for capturing within Win32 app:
...
...
m_hOldParent = ::GetParent(m_hCapturedWindow);
::GetWindowRect(m_hCapturedWindow, m_RectCapturedWindow);
// Now capture
FromHandle(m_hCapturedWindow)->ModifyStyle(WS_OVERLAPPEDWINDOW, 0);
::SetParent(m_hCapturedWindow, GetSafeHwnd());
...
...


What happens is: the window is nicely integrated into my Win32 application, but I am not always able to use the buttons with the mouse.
The problem with the ComboBox in my window is: I can drop down the Combobox with the mouse, but the lists appear at a different position but when I move the window of the Win32 application in directon of 0,0 (x,y) of the display the list stays at the same place.
It is the same with the PushButtons: I can see, that the mouseover event is recognized by the Qt-Application (change of colour) but the buttondown event does only work if I position my Win32 application nearly display positon 0,0 (x,y). When I move the application in positiv display direction the mouseover event is recognized everywhere at the button but the buttondown event is not recognized anymore.

Another strange notice concerning Qt-Applications:
When I use "Microsoft Spy++" - "Finder Tool" my Qt-Application, just the simple window with two PushButtons and one ComboBox, has always the same handle within the window - no matter where I am with the mouse within the window - this is different to other windows on desktop. Does somebody know why Qt widgets have no own handle within the window.

What's going wrong here?

Would be nice, if somebody could help me.

QtUser2012