弄了好久了。。就是不行啊。。
有两个问题
要实现执行代码:mshta vbscript:createobject("sapi.spvoice").speak("I LOVE YOU.")(window.close)
这行语句是。。不管是在构造函数还是在其他函数都没有反应。。
QChar afterChar = QChar::fromAscii(34);
QChar before = QChar::fromAscii(39);
QString alarmStr("vbscript:createobject('sapi.spvoice').speak('hello')(window.close)\n");
qDebug()<<"before:"<<alarmStr;
alarmStr.replace(before, afterChar);
qDebug()<<"after:"<<alarmStr;
const char * p = alarmStr.toLocal8Bit().data();
QProcess pro(0);
pro.start("mshta.exe");
pro.waitForStarted();
pro.write(p);
pro.waitForFinished();
qDebug()<<pro.readAllStandardError();
qDebug()<<QString::fromLocal8Bit(pro.readAllStandardOutput());
把这个p当成参数也不行。。老是解析错误解析成speak(\"sapi.spvoice\")这样的样子了。。
2.第二个问题,是关于MySQL备份的
QProcess *pro = new QProcess(this);
pro->start("mysqldump.exe", QStringList()<<"-uroot"<<"-p123"<< "test>"<<"c:\\gh.sql", QIODevice::ReadWrite);
pro->waitForStarted();
//pro->write("test>c:\\back.sql");
pro->closeWriteChannel();
pro->waitForFinished();
qDebug()<<pro->readAllStandardOutput();
qDebug()<<pro->readAllStandardError();
错误时:Unknown database 'test>' when selecting the database
写成QStringList()<<"uroot"<<"-p123"<<"test>c:\\gh.sql"
错误成:Unknown database 'test>test>c:\\gh.sql' when selecting the database
哪位大侠给解答下。。感激不尽啊。。。