你是用QProcess::exec()来调用的么?
试试多线程就可以了
class MyThread : public QThread
{
Q_OBJECT
public:
MyThread(QObject* parent = 0) : QThread(parent) {
connect(this, SIGNAL(finished()), this, SLOT(onFinish()));
}
virtual void run()
{
char* windir;
if(!_dupenv_s(&windir, NULL, "windir"))
{
QString calcPath(tr(windir) + "\\system32\\calc.exe");
QProcess::execute(calcPath);
free(windir);
}
}
private slots:
void onFinish() {
delete this;
}
};
MyThread* thread = new MyThread;
thread->start();