Hi all,
I tried starting my QProcess in my service but it doesn't work, although it works nicely in an other program without service.
I want by my service to execute an other program.
there is the same code i userd in the service and the simple program :
if(m_pProcess == NULL)
{
m_pProcess
->setEnvironment
( QProcess::systemEnvironment() );
m_pProcess
->setProcessChannelMode
( QProcess::MergedChannels );
}
if(m_pProcess)
{
bool bValueStart = m_pProcess->startDetached("myProgram.exe");
m_pProcess->waitForStarted();
if(bValueStart)
{
qDebug()<< "OK";
return OK;
}
else
{
qDebug()<< "ERR";
return ERR;
}
}
if(m_pProcess == NULL)
{
m_pProcess = new QProcess;
m_pProcess->setEnvironment( QProcess::systemEnvironment() );
m_pProcess->setProcessChannelMode( QProcess::MergedChannels );
}
QStringList args;
if(m_pProcess)
{
bool bValueStart = m_pProcess->startDetached("myProgram.exe");
m_pProcess->waitForStarted();
if(bValueStart)
{
qDebug()<< "OK";
return OK;
}
else
{
qDebug()<< "ERR";
return ERR;
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks