I'm using the MS Web Browser ActiveX control in a native C++/Win32/MFC dialog application to render some information via HTML.
I'd like to print the contents without any user interaction to the specified printer (which is not the default printer). The printer I'd like to use is a PDF printer.
I'm using a nice wrapper class from Code Project which makes the using the Web Browser control a little easier (http://www.codeproject.com/Articles/3919/Using-the-WebBrowser-control-simplified) and one of the things that wrapper provides is printing. It provides a print method which uses ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,...) to initiate printing of the contents.
This works great and results in the contents of the control being printed to the default printer without any user interaction.
The challenge, then is to have it use a different printer than the default. My initial attempt was to call ::SetDefaultPrinter (http://msdn.microsoft.com/en-us/library/windows/desktop/dd162971(v=vs.85).aspx). This doesn't seem to work. It seems that, despite calling ::SetDefaultPrinter, the web browser ActiveX control still prints to the system default printer. Its as though it ignores whatever this call does.
I tried broadcasting the system settings change message as suggested in the MSDN link as well as directly sending it to the browser window without any luck.
Any ideas how I can get the web browser activex control to print the printer I specify instead of using the default printer?