Results 1 to 4 of 4

Thread: How to show application inside another application's window ?

  1. #1
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default How to show application inside another application's window ?

    Hello,

    We have a main program written in MFC (Windows) that has buttons to start different actions. Those actions are performed by external programs (.exe's or DLL) that are started by the main program.

    The external programs show their user interface INSIDE a window area of the main program. So it looks to the user as if it is all one integrated program. This is accomplished by giving the external programs the windows handle of the main application, and they use that as 'parent' for their main window.

    Now I would like to write an external program in Qt that works in the same way. Can it be done in Qt ?

    I was thinking of passing the windows handle to the constructor of my QMainWindow, but have no idea how to translate the windows handle to a QWidget pointer.

    Best regards,
    Marc

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to show application inside another application's window ?

    Translating the parent program's Windows window handle in to a QWidget pointer makes no sense unless the parent program is itself a Qt app and even then it doesn't seem to be what you want to do. It sounds like what you want is to re-parent your child Qt app's main widget using whatever Windows API calls the existing external programs use: I guess simply a call to the Windows API SetParent():
    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
    (but I'm no Windows API guru).
    You should be able to get the Windows window handle for your main widget using QWidget::winId().

    Qt Code:
    1. SetParent(this->winId(), passedInParentHandle);
    To copy to clipboard, switch view to plain text mode 
    The passedInParentHandle will come via a command line argument or somesuch.

  3. #3
    Join Date
    Aug 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: How to show application inside another application's window ?

    Hi,

    got the same problem but with x.

    I'm writing an app for my car-pc and i want to integrate Navit in my application.
    How can i do this?

    Btw.: In a M$ Windows environment it works like Chris described (at least with .NET).

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to show application inside another application's window ?

    XReparentWindow looks like the equivalent

Similar Threads

  1. Drawing widgets inside a Qt application
    By aughey in forum Qt Programming
    Replies: 4
    Last Post: 13th May 2010, 08:45
  2. Replies: 1
    Last Post: 15th April 2010, 19:05
  3. Replies: 2
    Last Post: 10th December 2009, 07:01
  4. Retrieving command line arguments inside a Qt application
    By prykHetQuo in forum Qt Programming
    Replies: 5
    Last Post: 14th February 2009, 14:28
  5. Run an application but show it in your own form?
    By triperzonak in forum Qt Programming
    Replies: 6
    Last Post: 27th September 2008, 02:37

Bookmarks

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.