A. QT 啟動與關閉外部程序
啟動
QString filepath = QDir::currentPath();
QString fullpath = filepath+"\\pp\\dist\\start";
QString title = fullpath+"\\main.exe";
title = title.replace("/","\\");
fullpath = fullpath.replace("/","\\");
襪答 QProcess p(this);
p.setWorkingDirectory(fullpath);
p.start("cmd", QStringList()<<"/c"<<"start main.exe");
p.waitForStarted();
p.waitForFinished();
關閉
QProcess p(this);
p.setWorkingDirectory(fullpath);
慶洞 p.start("告差慧cmd", QStringList()<<"/c"<<"taskkill /f /t /im main.exe");
p.waitForStarted();
p.waitForFinished();