LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

IWebBrowser2 PDF File

Hello,


I am using the Active IWebBrowser2 object to open a PDF file. The file loads successfully and displays without any issues.

 

Later in my application, I need to delete the PDF file. To release the file, I tried calling the Stop method on the IWebBrowser2 object, assuming it would close the file reference. However, when I attempt to delete the file afterward, I receive the following error:

LabVIEW: (Hex 0x5) File already open

 

IWebBrowser2.jpg

 

This suggests that the PDF file is still being held open by the browser control or an associated process.

 

Can someone advise on the correct method or procedure to fully release the PDF file and close any file handles associated with it? Is there a specific method other than Stop that should be used before deleting the file?

0 Kudos
Message 1 of 2
(134 Views)

The IWebBrowswer object is never closed. Since it is ActiveX, this means the object remains in memory and will keep any documents it opened active too.

 

Possible solutions:

 

1) Close the IWebBrowser reference (and any other ActiveX reference you open or get from methods and property nodes you call on it or one of its subobjects).

 

2) Load a different document into the IWebBroser. 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 2
(92 Views)