Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

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

    General and Desktop
    3
    4
    975
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Stefan last edited by Stefan

      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

      1 Reply Last reply Reply Quote 0
      • R
        Rondog last edited by Rondog

        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.

        1 Reply Last reply Reply Quote 1
        • JKSH
          JKSH Moderators last edited by

          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

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply Reply Quote 0
          • S
            Stefan last edited by

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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post