Restrictions can only start once the software:
QSharedMemory mem ( "untitled"); written in the main function:
if(!mem.create(1))
QMessageBox::about(0,"启动失败","An instance is running");
return 0; // essential
Start external software:
(1) QProcess * p = new QProcess; // start external software
p->start("D:/a/untitled/debug/untitled.exe");
(2)QProcess::startDetached("D:/a/build-untitled1-Desktop_Qt_5_5_1_MinGW_32bit-Debug/debug/untitled1");
Software Restart: Close the current software .close or qApp-> quiet; then start an external program;
Published 104 original articles
·
won praise 22
·
views 40000 +