yolip
December 3rd, 2008, 08:35 PM
Hi Guys,
I am using .NET 2 and trying to use SHDocVw.dll to print a html file to the printer, however, I found most of the time if i step line by line will works, but won't work during the runtime. The error is: Trying to revoke a drop target that has not been registered (Exception from HRESULT: 0x80040100 (DRAGDROP_E_NOTREGISTERED))
any idea?
Thanks
public bool Print_HTML_File(string path)
{
try
{
SHDocVw.InternetExplorer _ie = new SHDocVw.InternetExplorerClass();
Object o = new Object();
_ie.Navigate(path, ref o, ref o, ref o, ref o);
_ie.Visible = false;
_ie.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER,
ref o, ref o);
_ie=null;
o=null;
return true;
}
catch (Exception ex)
{
System.Diagnostics.Debug.Print(ex.Message);
return false;
}
}
I am using .NET 2 and trying to use SHDocVw.dll to print a html file to the printer, however, I found most of the time if i step line by line will works, but won't work during the runtime. The error is: Trying to revoke a drop target that has not been registered (Exception from HRESULT: 0x80040100 (DRAGDROP_E_NOTREGISTERED))
any idea?
Thanks
public bool Print_HTML_File(string path)
{
try
{
SHDocVw.InternetExplorer _ie = new SHDocVw.InternetExplorerClass();
Object o = new Object();
_ie.Navigate(path, ref o, ref o, ref o, ref o);
_ie.Visible = false;
_ie.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER,
ref o, ref o);
_ie=null;
o=null;
return true;
}
catch (Exception ex)
{
System.Diagnostics.Debug.Print(ex.Message);
return false;
}
}