CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002
    Location
    Australia
    Posts
    207

    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;
    }

    }

  2. #2
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    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
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured