Results 1 to 2 of 2

Thread: Hosting a Cwnd inside a widget

  1. #1
    Join Date
    Jul 2020
    Qt products
    MacOS X Unix/X11 Windows

    Default Hosting a Cwnd inside a widget

    Migrating a large application to Qt. I have a Window CDialog that I want to host inside a QWidget

    How to achieve that? QWinHost doesn't seem appropriate as that seems to require subclassing and modification of a native Windows app event loop which doesn't seem useful.

    No I cannot re-implement that dialog in Qt in short order - it will take months of work as it has 10 custom CWnd children not of which are in any way trivial (the smallest is around 3k of code).


  2. #2
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 864 Times in 851 Posts
    Qt products

    Default Re: Hosting a Cwnd inside a widget

    You might be able to make use of the QWinWidget class that can be found in the Qt Windows Migration library. This is not part of the standard Qt distribution, so you will probably have to build it yourself. The library was written to help in solving exactly your problem - porting from a Windows application to Qt and hosting a native Windows HWND inside of a Qt widget.

    Edit: I see from posts you have made on this same question in other forums that you are already using the Qt migration library, so you are already aware of QWinWidget.
    Last edited by d_stranz; 16th September 2022 at 20:01.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. how create CWnd and use it in Qt
    By litterflybug in forum Qt Programming
    Replies: 5
    Last Post: 11th July 2013, 11:20
  2. Replies: 8
    Last Post: 2nd February 2012, 19:52
  3. Replies: 5
    Last Post: 14th December 2011, 11:51
  4. Replies: 8
    Last Post: 28th June 2011, 14:57
  5. How to create CWnd from QWidget?
    By vudvpro in forum Qt Programming
    Replies: 5
    Last Post: 10th May 2011, 11:01


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.