2012-03-30 85 views
0

任何人都可以给我解决方案如何通过参数调用另一个应用程序。以及如何开始由参数调用的过程。在VB代码的情况是:通过Qt参数调用另一个应用程序

启动程序由PARAM:

Sub main() 
    if command$ <> vbnullstring then ... running the process 
end sub 

通话过程PARAM:

Dim shell As wshShell 
Dim lngReturnCode As Long 
Dim strShellCommand As String 

Set shell = New wshShell 

strShellCommand = "C:\Program Files\My Company\MyProg.exe " & _ 
"-Ffoption -Ggoption" 

lngReturnCode = wshShell.Run(strShellCommand, vbNormalFocus, vbTrue) 

我索里对我的英语不好,我需要的源代码由QT。感谢前^^

+1

你看所有的QProcess中的文档?你有什么尝试? – Mat 2012-03-30 12:05:39

+0

啊,我看到如何运行一个进程。 <=解决了。感谢的@Mat 现在,我想了解如何通过参数启动一个进程? – user1276647 2012-03-30 12:54:02

+0

继续阅读该文档,尝试一下,然后编辑此问题,并使用迄今为止的代码进行编辑。 – Mat 2012-03-30 12:55:49

回答

1

的只需提供一个QStringList中的arguements看到http://doc.qt.nokia.com/4.7-snapshot/qprocess.html#details

 QObject *parent; 
    ... 
    QString program = "./path/to/Qt/examples/widgets/analogclock"; 
    QStringList arguments; 
    arguments << "-style" << "motif"; 

    QProcess *myProcess = new QProcess(parent); 
    myProcess->start(program, arguments); 
相关问题