Results 1 to 7 of 7

Thread: How run Windows QProcess Window inside QWidget

  1. #1
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default How run Windows QProcess Window inside QWidget

    I need use a QProcess to open an external exe file, and show that window without titlebar and with a selected size.
    I'm not sure how achieve this, maybe running the external application inside a QWidget that I can control?
    I supose Qt can't control the QProcess window size and titlebar in Windows, so I hope there is some way to do this, is very important for my application.
    Any help with this problem please?
    I want to add a frame (bezel) around the external application, is the final objetive, like this image:

    bezelss.gif
    Always trying to learn >.<

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: How run Windows QProcess Window inside QWidget

    QProcess does not provide a way for you to do what you want. You can launch the program using QProcess, but no way to wrap its GUI inside of a Qt Widget that I'm aware of.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How run Windows QProcess Window inside QWidget

    You will need platform specific APIs for some of that.

    One thing you need to get is the platform's native window handle for the other program, then you can use QWindow::fromWinId() to wrap it in QWindow, which you can then embed in a widget using QWidget::createWindowContainer().

    That is all Qt can do for you there, your other objectives might or might not be possible depending on the native API.

    Cheers,
    _

  4. #4
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How run Windows QProcess Window inside QWidget

    thanks both for the answers, I done it with (this hide the titlebar for example) :

    HWND hWnd = FindWindow(L"KegaClass", NULL);

    LONG_PTR lStyle = ::GetWindowLongPtr(hWnd, GWL_STYLE);
    lStyle &= ~WS_CAPTION;
    ::SetWindowLongPtr(hWnd, GWL_STYLE, lStyle);

    qDebug() << hWnd;
    But i still have a question, theres is a way to get the Windows HWND from a qProcess?
    I'd like to get the Windows HWND from the QProcess I start in my aplication when I launch it.
    Last edited by aguayro; 5th April 2015 at 13:46.
    Always trying to learn >.<

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How run Windows QProcess Window inside QWidget

    QProcess doesn't know anything about the child process' internals, e.g. whether it has UI at all or if it has which windows it uses.
    The only thing it knows it the process ID.

    Maybe your platform native API provides functions to query for UI resources such as windows given the process ID.

    Cheers,
    _

  6. #6
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How run Windows QProcess Window inside QWidget

    Yeah, ti's solved, thanks a lot for the directions

    I've used EnumWindows form windows api and QProcess:id(), hope can help somebody in the future.
    Always trying to learn >.<

  7. #7
    Join Date
    Apr 2014
    Posts
    3
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How run Windows QProcess Window inside QWidget

    Example please

Similar Threads

  1. QWidget inside MFC project
    By hINTModuleState in forum Newbie
    Replies: 3
    Last Post: 9th October 2015, 16:22
  2. How to set window to active window based on QProcess?
    By tahayassen in forum Qt Programming
    Replies: 1
    Last Post: 2nd April 2013, 10:28
  3. How to use QDockWidgets inside a QWidget ?
    By Comer352l in forum Qt Programming
    Replies: 5
    Last Post: 13th January 2011, 13:39
  4. Open a window inside another window
    By passerb in forum Qt Programming
    Replies: 6
    Last Post: 18th October 2009, 14:24
  5. QProcess inside QProcess
    By bunjee in forum Qt Programming
    Replies: 7
    Last Post: 4th December 2008, 01:39

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.