LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX, print command to IWebBrowser2

Hello together

I am trying to print a html file by using active x with object "IWebBrowser2" and it's my first time that I use active x 🙂

Setup: LabView 2019, 32-bit with Win7 64-bit computer.

What I want to do:

  • Using active x to open a local stored html file by using the object "IWebBrowser2" --> Works fine
  • Use the command "print file" with "do not prompt user" --> doesn't work

Goal ist to program the sequence like an operator opens the html file, which opens it with the InternetExplorer/Firefox and clicks on File-Print.

I know that I could use the "report generation" but after some tests, I would like to use the way with active x.

 

First question - are there some negative points by using active x?

Second question - could anybody help me, why my code doesn't work?

 

Someone had the same problem as I have, but even with his solution, it does not work: https://forums.ni.com/t5/LabVIEW/Print-file-via-ActiveX-and-it-is-not-found-always/td-p/1667298/page...

I analysied as well the code under find examples "browser" -> "ActiveX Event Callback for IE", but can't find my bug.

Alll Vi's with html-file are attached.

 

Why are there so many "IWebBrowser2" Objects and how can I find out which one is the one, that I need? Because I saw that the property/invoke nodes entries changes sometimes by using another object...

LN86_0-1594886406520.png

 

So this is my first vi. Silent and Visible doesn't work, it opens always the internet explorer, but it open it:

LN86_1-1594890878352.png

 

and the second one, which is never exectued (callback vi):

LN86_2-1594890940008.png

 

It doesn't work even if I copy this code into the first vi. I always receive an error...

 

Thx in advance.

0 Kudos
Message 1 of 2
(2,374 Views)

By the way the error is:

"Error -2147221248 occurred at Trying to revoke a drop target that has not been registered
in IWebBrowser2PrintHtmlFile.vi

This error code is undefined. Undefined errors might occur for a number of reasons. For example, no one has provided a description for the code, or you might have wired a number that is not an error code to the error code input.

Additionally, undefined error codes might occur because the error relates to a third-party object, such as the operating system or ActiveX. For these third-party errors, you might be able to obtain a description of the error by searching the Web for the error code (-2147221248) or for its hexadecimal representation (0x80040100)."

 

0 Kudos
Message 2 of 2
(2,372 Views)