QT 启动与关闭外部程序

QT 启动与关闭外部程序,第1张

启动

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()

在编辑器中输入相应的代码即可关闭。

win11关闭外部编辑器方法:1.首先纯粹的打开外部应用程序,找到编辑器。2.其次在编辑器中输入相应的代码。3.最后按回车退出外部应用程序即可关闭外部编辑器。

Windows11,是由微软公司(Microsoft)开发的 *** 作系统,应用于计算机和平板电脑等设备。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/12045303.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-20
下一篇2023-05-20

发表评论

登录后才能评论

评论列表(0条)

    保存