Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing an .htm document using the WebBrowser control

Status
Not open for further replies.

keithf01

Programmer
Jun 24, 2002
13
0
0
US
The code below used to work but is now throwing the following error:
'Trying to revoke a drop target that has not been registered'.

//Code Start
WebBrowser1.Navigate strFilePath
' stall logic here to allow browser to navigate to
' file (strfilepath is the location of the file)
WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0
' this is where the error is thrown.
// Code End

Value of OLECMDID_PRINT is 6
Value of OLECMDEXECOPT_DONTPROMPTUSER is 2

Anoter site suggested to try the following code:

// Code Start
Do While WebBrowser1.QueryStatusWB(OLECMDID_PRINT) <> OLECMDF_SUPPORTED + OLECMDF_ENABLED
DoEvents
Loop
// Code End

The problem is that OLECMDID_Print will never equal
(OLECMDF_SUPPORTED + OLECMDF_ENABLED).
They are all constant values. 6 will never equal 1 + 2

Thanks in advance for any help.

Regards,
Keith

 
I'm starting to think that a windows update has killed this function. I have another PC that is not connected to the internet so it does not recieve windows updates.
The code still works on this box but not on the boxes that
have recieved windows updates.
But I could be wrong, it's been know to happen.

So if anyone else has anything please let me know.

Thanks,
Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top