使用C++处理不同的应用程序
Handle different application using C++
是否有任何方法可以使用c++/qt控制其他windows应用程序?
我有:1000个特定图像格式的文件和一个可以打开它们的应用程序。此应用程序可以使用"另存为…"功能将这些文件逐个保存为".JPEG"格式。我想自动做到这一点。
有什么技巧可以做到这一点吗?提前谢谢!
使用QT,您可以使用QProcess实例运行单独的进程。
特别假设您的外部应用程序接受输入参数(例如,要加载的文件路径和存储结果的文件路径)
QProcess shell;
QStringList argv;
//[setup argument-list]
shell.setProcessChannelMode(QProcess::MergedChannels);
shell.start(commandPath, argv);
shell.waitForFinished();
请注意,QProcess可以用作IO流。这有助于与流程交互(例如检索进度信息):
shell.start(commandPath, argv);
shell.waitForReadyRead();
while(shell.state() == QProcess::Running || !shell.atEnd()){
auto s = shell.readLine()
//[do something with the current line of the process output]
}
QProcess::ExitStatus es = shell.exitStatus () ;
当然,外部流程必须接受输入参数,并通过其标准输出提供反馈,以解决您的问题。
相关文章:
- 试图在visual studio上用C++创建一个桌面应用程序
- FFmpeg:制作一个应用程序比直接使用ffmepg更好吗
- 在C应用程序中运行C++(带有STL)函数
- 使用VerQueryValue检索应用程序的文件描述
- Qt C++静态thread_local QNetworkAccessManager是线程应用程序的好选择吗
- 使用调试/崩溃报告将应用程序部署到客户端
- C++控制台应用程序阻止退出
- 码头化的C++应用程序是否向后兼容早期的内核版本
- 将应用程序从32位移植到64位时出现问题
- 如何改变c++应用程序的视觉效果
- WM_CTLCOLORSTATIC从未在WIN32应用程序中触发
- PC中的程序和PHONE中的本机描述应用程序之间的数据连接
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 示例外壳应用程序显示的 V8 "segmentation fault (core dumped)"错误
- phytec phyBOARD iMX-6在从闪存而不是SD卡运行qt5 opengles应用程序时表现不佳(FPS减半
- 为什么导入Mixed native/CLR lib.dll的本机C++应用程序没有在Mixed lib.dll中的外部变
- 如何从Windows应用程序输出到标准?
- C++应用程序 MySQL odbc 数据库连接错误:在引发"otl_tmpl_exception<>"实例后终止调用
- 如何在 64 位 vb.net Windows 应用程序中引用 32 位 dll
- 如果整个应用程序是虚拟映射的,为什么 new 会进行系统调用?