Printing HTML pages
-
Hello Does anyone know how to print HTML files from a console application? I wanna print the files like the I Explorer shows them not the source code . I think a solution could be using IWebBwoser control but i don't know how to embed it to a console application Thanks a lot xxx
-
Hello Does anyone know how to print HTML files from a console application? I wanna print the files like the I Explorer shows them not the source code . I think a solution could be using IWebBwoser control but i don't know how to embed it to a console application Thanks a lot xxx
You could write a simple web resource provider[^] to download the page to disk, then just print the file by doing:
// Print file
CString strPrintFile = "MyFile.htm";
SHELLEXECUTEINFO seInfo;
::ZeroMemory (&seInfo, sizeof (seInfo));
seInfo.cbSize = sizeof (seInfo);
seInfo.fMask = SEE_MASK_FLAG_DDEWAIT;
seInfo.hwnd = GetSafeHwnd();
seInfo.lpVerb = "print";
seInfo.lpFile = strPrintFile.GetBuffer(0);
seInfo.lpDirectory = "";
seInfo.nShow = SW_SHOWNORMAL;
BOOL bStatus = ::ShellExecuteEx (&seInfo);
strPrintFile.ReleaseBuffer();// Warn user on error
if (!bStatus) {
CString strMessage;
strMessage.Format (IDS_CantPrintFile, strPrintFile.GetBuffer(0));
strPrintFile.ReleaseBuffer();
AfxMessageBox (strMessage);
}/ravi Let's put "civil" back in "civilization" Home | Articles | Freeware | Music ravib@ravib.com