Can i insert the external exe file window inside of GUI?
I have created the code if i click push button, then the external exe file runs. But i want to place this external file window where i want inside of GUI with push button when i click push button. So that external file is moving together. Is it possible? Can anyone help me?
This is my code for push button to execute external file.
void MainWindow::on_pushButton_8_clicked()
{
QProcess *process = new QProcess(this);
QString file("D:\\\My External File name");
process->execute(file);
QDesktopServices::openUrl(QUrl("file:///"+file,QUrl::TolerantMode));
}
Re: Can i insert the external exe file window inside of GUI?
Try this :cool:
Code:
QString prog
= "D:\\Program\\program.exe";
arg << "arg1" << "arg2";
program->startDetached(prog, arg, workDir, 0);
WId hWnd = 0;
while (hWnd == 0)
{
hWnd = (WId) FindWindowW(NULL, L"D:\\Program\\program.exe");
}
window = QWindow::fromWinId(hWnd);
container
= QWidget::createWindowContainer(window, ui
->mdiArea
);
QMdiSubWindow *subWindow = new QMdiSubWindow();
subWindow->setWidget(container);
subWindow->setAttribute(Qt::WA_DeleteOnClose);
subWindow->setWindowTitle("Program 1");
ui->mdiArea->addSubWindow(subWindow);
container->show();
Re: Can i insert the external exe file window inside of GUI?
Quote:
Originally Posted by
shame
Try this :cool:
Code:
QString prog
= "D:\\Program\\program.exe";
arg << "arg1" << "arg2";
program->startDetached(prog, arg, workDir, 0);
WId hWnd = 0;
while (hWnd == 0)
{
hWnd = (WId) FindWindowW(NULL, L"D:\\Program\\program.exe");
}
window = QWindow::fromWinId(hWnd);
container
= QWidget::createWindowContainer(window, ui
->mdiArea
);
QMdiSubWindow *subWindow = new QMdiSubWindow();
subWindow->setWidget(container);
subWindow->setAttribute(Qt::WA_DeleteOnClose);
subWindow->setWindowTitle("Program 1");
ui->mdiArea->addSubWindow(subWindow);
container->show();
Thanks a lot. What is "d:\\program" on 4th line? Directory of file? and program->startDetached, this code has error, use of undeclared identifier 'program'
QString prog = "D:\\Program\\program.exe";
QStringList arg;
arg << "arg1" << "arg2";
QString workDir = "d:\\Program";
Re: Can i insert the external exe file window inside of GUI?
Working directory. Also add to .h file
Code:
WId id;
QWindow *window;