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