How to capture WebBrowser's OnAfterPrint event in C++?

C

Carl Manson

Hi All,

I am writing a complex print job solution that requires the printing
of many HTML documents in an exactly defined order. Our application
uses the IE WebBrowser control to render the documents, then fire them
off to the printer. It is all fully automated, so no user interaction
is required.

However, some documents are larger than others and take longer to
spool. The standard behaviour of spoolers/print queues is FIFO, but
FIFO from when the document finishes spooling, not starts spooling.
So a large document can still be spooling when a smaller subsequent
one has spooled. The smaller doc will print first... disaster for my
clients.

I want to catch the OnAfterPrint event that I've read about in MSDN.
This way I can pause the process until the previous document has
spooled. I'm using VC++ 6 and MFC. I can not find anywhere that
gives an example of how to handle this event in C++.

The only example I have is in VB (of which I know very little). From
MSDN...

=============================
Dim WithEvents win As HTMLWindow2
Attribute win.VB_VarHelpID = -1

Private Sub Form_Load()
WebBrowser1.Navigate "http://www.microsoft.com"
End Sub

Private Sub Command1_Click()
WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER,
Empty, Empty
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As
Variant)
If pDisp Is WebBrowser1.object Then
Set win = pDisp.Document.parentWindow
End If
End Sub

Private Sub win_onafterprint()
MsgBox ("Done printing!")
End Sub
=============================

Any help will be most appreciated.

Thanks in advance,
Carl Manson.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,090
Members
48,773
Latest member
Kaybee

Latest Threads

Top