Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] Show HWND from a win32 application in a QMdiSubwindow



  • Hello everyone,

    my job is to replace the GUI of a win32 application by Qt. The application is quite complex and we want a step by step integration of the graphical elements. Is it possible to show a HWND from an existing win32 application in a QMdiSubwindow?

    I have found the QWinHost Documentation, but I am not sure if this is the right approach. Does anyone have experience with it?

    Thanks in advance.

    Stefan



  • That link is old (Qt 3.x). This class might not exist in current versions of Qt.

    I assume you want to minimize changes to the parts of the program that use SendMessage() as much as possible. I believe you can get the HWND value for all widgets (winId() ?) although I have not tried this. You will need to setup a callback function as well to monitor for messages.

    I would avoid this if I were you. Hopefully your application separated the GUI from the program which will help when porting (usually is not the case). The signal/slot from Qt would be the replacement for SendMessage() for user defined messages.


  • Moderators

    Hi @Stefan, and welcome to the Qt Dev Net!

    That functionality is not officially supported in Qt 5. It's kind of possible, but it's buggy.

    See here for an example: https://forum.qt.io/topic/43708/can-t-receive-key-and-mouse-wheel-events-after-qwidget-createwindowcontainer



  • Thank you for your advice, i guess we have to refactor parts of the code to meet our goal.


Log in to reply