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

Runing a .exe inside a form



  • I want to run a external application inside a window created in Qt. In Visual Studio using c# I can do:

    [DllImport("user32.dll")]
    static extern IntPtr SetParent(IntPtr hwc, IntPtr hwp);

    Process p = Process.Start("calc.exe");
    Thread.Sleep(1000);
    p.WaitForInputIdle();
    SetParent(p.MainWindowHandle, this.Handle);

    This way calculator from Windows will be inside my application. Can we do the same with Qt?



  • Hi HugoMandes,

    see the Qt-Documentation -> http://doc.qt.io/qt-5/qprocess.html
    It's also possible to get the window handle from the Qt Widget (http://doc.qt.io/qt-5/qwidget.html#winId).

    But in the past I want to embedded the Microsoft Excel inside the Qt application and this not work very well. I think it's easier to use only the microsoft eco system if possible - or a work around before embedding/drawing/event-handling a application inside a Qt application.

    Regards,
    Jakob


Log in to reply