Quote Originally Posted by kandalf
I don't know in Qt4, haven't tried it in Windows yet, but in Qt3, you can't launch cmd.exe or command.com with QProcess.
I don't know why, it doesn't raise any error, but just doesn't work.


Cheers.
Qt Code:
  1. // open NEAppRoster.html
  2. QString strNARfile = this->ReportPath;
  3. strNARfile.append("NEAppRoster.html");
  4. QFile file(strNARfile );
  5. if (!file.open(QIODevice::WriteOnly | QIODevice::Text)){
  6. ui.leStatus->setText("Can't open n458.txt file for output");
  7. return;
  8. }
  9. ui.leStatus->setText("Stand by ....processing...");
  10. QTextStream out(&file);
  11. out << fheader << endl
  12. out << this->HTML_Header1 ;
  13. out << "Nebraska Exemption Application Roster " << this->dbYear << endl ;
  14. out << this->HTML_Header2 << endl;
  15. // ... snip some code which streams rows of data into "out" in html form ...
  16. out << this->HTML_Footer << "\n";
  17. file.close();
  18. QStringList sRpt; // required argument for QProcess execute
  19. //prepend "file:" to filename so IE or Konqueror knows what it is
  20. sRpt << strNARfile.prepend("file:");
  21. //assume we are running on Windows. Probably will be long after I retire
  22. QString sIE = "C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE";
  23. QProcess webbrowser;
  24. int dummy = webbrowser.startDetached(sIE, sRpt); // a simple string can't replace sRpt
  25. dummy = 0; // to avoid compiler warning about assigned but unused var
To copy to clipboard, switch view to plain text mode