WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
Sometimes you have to print HTML files from your Visual C++ program. If Microsoft's Internet Explorer is installed, this can be done easily by just calling ShellExecute(hwnd, "print", "my_file.html", 0, 0, SW_SHOW).
Unfortunately, this way you don't have any control over the header/footer lines that the Web browser prints.
Just say #include "print_html.h" at the beginning of your cpp file and add "print_html.cpp" to your workspace. Now it is possible to print HTML files with the following lines of code:
C_PrintHtml ph; ph.PrintHtml("my_file.html");
You can find "print_html.cpp" and "print_html.h" (as well as a simple example of how to use the module) in the attached zip archive. I used VC++ 7.0 to create the example. The module has been tested with Internet Explorer 6 on Windows NT4 SP6a, Windows 2000 SP2, and Windows XP Professional.
Tilman Kuepper (email@example.com)