Embed 3rd party application into QWidget
Unsolved
3rd Party Software
-
Hi everyone,
I've been struggling with a question for some time that seemed quite easy at the beginning.
I want to embed an application (for example, Windows Calculator) into a QWidget. I've tried with this code:
Widget.cpp
Widget::Widget(QWidget *parent) : QWidget(parent) { QProcess::startDetached("c:\\windows\\system32\\calc.exe"); HWND ID = FindWindowA(NULL, "Calculator"); QWindow *Window = QWindow::fromWinId((WId)ID); Window->setFlags(Qt::FramelessWindowHint); QWidget *Widget = QWidget::createWindowContainer(Window); QVBoxLayout *Layout = new QVBoxLayout(this); Layout->addWidget(Widget); setLayout(Layout); }
main.cpp
int main(int argc, char *argv[]) { QApplication a(argc, argv); Widget w; w.show(); return a.exec(); }
The issue is that, although calculator opens, it shows behind every other window, and is placed in x:0, y:0 in screen.
Does anyone has any idea why is happening this?
Thanks