I've looked everywhere but still haven't found a solution. My need is
simple, I want to have the embeded Mozilla ActiveX control to print
automatically when a document finished downloading.

So, what I did was to add a DocumentCompleted event to the Mozilla
control:



private void axMozillaBrowser1_DocumentComplete
(object sender,
AxMOZILLACONTROLLib.DWebBrowserEvents2_DocumentCompleteEvent e)
{

if (axMozillaBrowser1.ReadyState ==
MOZILLACONTROLLib.tagREADYSTATE.READYSTATE_COMPLETE &&
axMozillaBrowser1.Busy == false) {

MOZILLACONTROLLib.OLECMDID cdPrint =
MOZILLACONTROLLib.OLECMDID.OLECMDID_PRINT;

MOZILLACONTROLLib.OLECMDEXECOPT cdDontPromptUser =
MOZILLACONTROLLib.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER;

object _null = null;

axMozillaBrowser1.ExecWB(cdPrint, cdDontPromptUser, ref _null, ref
_null);
}

}


As much as I wanted this to work, it doesn't. What I found out is, even
when the document completed event is fire, the mozilla control is
neither "complete" nor "not busy."

So, my next step is to add a while loop inside the document complete,
hoping that when the readystate changed to complete and the control
becomes not busy, it will print automatically.

It didn't work neither. I thought that it may be a threading issue. So,
I make the while loop a separate thread.

This seemed to work better. But then, I found that a successful url
change could lead to multiple document complete events. OK, so I added
a routine to make sure only the first document complete events fire the
thread to test the mozilla control's state.

This got me really close. Except that, when it actually printed, I got
a COMException.

At this point, I gave up.

I would be really appreciate anyone who can give me a hand on how to
solve this mystery.


Pixel Slave

_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to