-
December 3rd, 2008, 09:35 PM
#1
SHDocVw DLL Question
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;
}
}
-
December 9th, 2008, 08:56 PM
#2
Re: SHDocVw DLL Question
try printing after the document has loaded (document complete event fires) and don't start destroying objecst until things have printed
-
December 10th, 2008, 03:18 AM
#3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|