473,766 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DSOleFile.dll use in VB.NET

Hi all,

I am trying to use the DSOleFile.dll in my VB.NET application (that I am
converting from VB6) to extract some property data from a Word document
before the application processes the file. The key feature of the dll is
that it allows the data to be extracted without the document opening in
Word; I successfully used it in VB6 without a problem.

Under .NET, however, after I use a function that calls the dll, the function
appears to keep the file open, so my app can't delete it as it is supposed
to. The code is below:

Private oFilePropReader As DSOleFile.Prope rtyReader

Private oDocProp As DSOleFile.Docum entProperties

'^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^

Public Function getLastEditProp erty(ByVal strDoc As String) As String

Dim oFilePropReader As New DSOleFile.Prope rtyReader

oDocProp = oFilePropReader .GetDocumentPro perties(cXFer & strDoc & ".doc")

getLastEditProp erty = oDocProp.LastEd itedBy

oDocProp = Nothing

oFilePropReader = Nothing

End Function
Anybody have any ideas on how to force a release? Am fairly new to .NET...
is there something I am missing?

TIA and have a great day!

Steve Lang
Nov 20 '05 #1
3 3560
Hi,

System.Runtime. InteropServices .Marshal.Releas eComObject(oDoc Prop)

System.Runtime. InteropServices .Marshal.Releas eComObject(oFil ePropReader)

Ken

--------------------------

"Steve Lang" <no*****@Nohow. not> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi all,

I am trying to use the DSOleFile.dll in my VB.NET application (that I am
converting from VB6) to extract some property data from a Word document
before the application processes the file. The key feature of the dll is
that it allows the data to be extracted without the document opening in
Word; I successfully used it in VB6 without a problem.

Under .NET, however, after I use a function that calls the dll, the
function
appears to keep the file open, so my app can't delete it as it is supposed
to. The code is below:

Private oFilePropReader As DSOleFile.Prope rtyReader

Private oDocProp As DSOleFile.Docum entProperties

'^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^

Public Function getLastEditProp erty(ByVal strDoc As String) As String

Dim oFilePropReader As New DSOleFile.Prope rtyReader

oDocProp = oFilePropReader .GetDocumentPro perties(cXFer & strDoc & ".doc")

getLastEditProp erty = oDocProp.LastEd itedBy

oDocProp = Nothing

oFilePropReader = Nothing

End Function
Anybody have any ideas on how to force a release? Am fairly new to .NET...
is there something I am missing?

TIA and have a great day!

Steve Lang

Nov 20 '05 #2
Thanks Ken - works like a champ!

Steve
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:uV******** ******@tk2msftn gp13.phx.gbl...
Hi,

System.Runtime. InteropServices .Marshal.Releas eComObject(oDoc Prop)

System.Runtime. InteropServices .Marshal.Releas eComObject(oFil ePropReader)

Ken

--------------------------

"Steve Lang" <no*****@Nohow. not> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi all,

I am trying to use the DSOleFile.dll in my VB.NET application (that I am
converting from VB6) to extract some property data from a Word document
before the application processes the file. The key feature of the dll is
that it allows the data to be extracted without the document opening in
Word; I successfully used it in VB6 without a problem.

Under .NET, however, after I use a function that calls the dll, the
function
appears to keep the file open, so my app can't delete it as it is supposed to. The code is below:

Private oFilePropReader As DSOleFile.Prope rtyReader

Private oDocProp As DSOleFile.Docum entProperties

'^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^

Public Function getLastEditProp erty(ByVal strDoc As String) As String

Dim oFilePropReader As New DSOleFile.Prope rtyReader

oDocProp = oFilePropReader .GetDocumentPro perties(cXFer & strDoc & ".doc")
getLastEditProp erty = oDocProp.LastEd itedBy

oDocProp = Nothing

oFilePropReader = Nothing

End Function
Anybody have any ideas on how to force a release? Am fairly new to ..NET... is there something I am missing?

TIA and have a great day!

Steve Lang


Nov 20 '05 #3
Hi Ken,

Thanks! The code works on my development machine. However, when I try to run
it on the target computer, I am getting errors regarding the DSOLEFile.dll.
Specifically: "The format of the file 'Interop.DSOleF ile.dll' is invalid."
I don't understand what the difference is between the development computer
where I wrote the code and it works, and the target machine where it NEEDS
to work! I registered the dll successfully, so I don't think that is the
issue. Any ideas anyone?

TIA,

Steve
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:uV******** ******@tk2msftn gp13.phx.gbl...
Hi,

System.Runtime. InteropServices .Marshal.Releas eComObject(oDoc Prop)

System.Runtime. InteropServices .Marshal.Releas eComObject(oFil ePropReader)

Ken

--------------------------

"Steve Lang" <no*****@Nohow. not> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi all,

I am trying to use the DSOleFile.dll in my VB.NET application (that I am
converting from VB6) to extract some property data from a Word document
before the application processes the file. The key feature of the dll is
that it allows the data to be extracted without the document opening in
Word; I successfully used it in VB6 without a problem.

Under .NET, however, after I use a function that calls the dll, the
function
appears to keep the file open, so my app can't delete it as it is supposed to. The code is below:

Private oFilePropReader As DSOleFile.Prope rtyReader

Private oDocProp As DSOleFile.Docum entProperties

'^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^

Public Function getLastEditProp erty(ByVal strDoc As String) As String

Dim oFilePropReader As New DSOleFile.Prope rtyReader

oDocProp = oFilePropReader .GetDocumentPro perties(cXFer & strDoc & ".doc")
getLastEditProp erty = oDocProp.LastEd itedBy

oDocProp = Nothing

oFilePropReader = Nothing

End Function
Anybody have any ideas on how to force a release? Am fairly new to ..NET... is there something I am missing?

TIA and have a great day!

Steve Lang


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1714
by: | last post by:
I am using Microsoft's dsofile (http://support.microsoft.com/support/kb/articles/Q224/3/51.asp) in an ASP to update a set of custom properties in a Word document. The document properties are always correctly updated after running the script on the ASP. However, after running the ASP for the second or third time IIS will lock and will fail to respond to any request until I restart IIS or get some error (note that the error is not always the...
14
8737
by: Curtis Tammany | last post by:
Hello- Can someone tell me if DSOFile.dll can be accessed within ASP.NET? DSOFile.dll is registered and I have no problem using it in my .ASP scripts. I have tried the following: Dim oFilePropReader As DSOleFile.PropertyReader Dim oFileProperties As oFilePropReader.GetDocumentProperties("C:\MyDoc.doc") Response.write ("<table>" & vbCRLF) Response.write ("<tr><td><B>Title: </B></td><td>" & oFileProperties.Title & "</td></tr>" &...
4
5377
by: Craig | last post by:
I'm trying to build a filter for a file search where the search will be able to filter out certain files according to certain "file properties", like Owner, Creation Date, etc. MS does this in some Open dialogs, within the dialog, you can click on Tools->Search->Advanced and search for files with specified file properties. Any ideas on how this is done in C#?
0
1257
by: Jason | last post by:
I am porting some legacy services to C# and .NET. I have run across two issues with using DSOLEFILE in .NET, and was hoping somebody might shed some light... 1. Access Files Across the Network My application is a service. I am able to use File.Exists to confirm the existence of a file, but when I do someting like: PropertyReader objReader = new PropertyReader();
0
1248
by: Robert | last post by:
Somebody converted the DSOlefile ( dsofile.dll ) example to VB.Net ? It seems that the automatic conversion is NOT complete correct ! I received all (Ms-Office) document properties except the preview (oDocProp.Thumbnail) and the document icon (oDocProp.icon).
0
2572
by: troutbum | last post by:
I am experiencing problems when one user has a document open through a share pointing to the web site. I use the dsolefile to read the contents of a particular directory and then display them in a datalist. When the next user selects trys to run the page, the page fails and I get a generic error message from the stack trace. I am assuming that the document properties cannot be read when a file is open, but it worked well in asp. ...
2
5880
by: Marco | last post by:
Hello, I have to use the propertyReader of DSOFile.dll for reading/writing custom document properties in a closed document. In the msdn http://support.microsoft.com/?scid=kb;en-us;Q224351 "....However, to save resources at run time, it is recommended that you explicitly create and destroy a PropertyReader object when needed. If you allow Visual Basic to implicitly create the object, it is not released until your application...
4
11159
by: Paul Bromley | last post by:
I have been pondering over this one all night!! I want to read the properties of a Word document WITHOUT opening it - notably the title document. Having read the newsgroups it seems that I neede to download from the MS site the DSOFile package containing the said DLL. However on looking in the newsgroups the best option to me seems to be using the DSOleFile.PropertyReader and then the GetDocumentProperties property, but this seems to be...
0
1274
by: Henrik | last post by:
Hi, I'm trying to set CustomProperties through the newer version of the DSOleFile (2.x) object for Word, Excel and PowerPoint documents. For some reason it seems that when I'm trying to set a custom property to an empty string ("") it will simply cause all the other existing properties including the newly created on to disappear when trying to look at them by right clicking on properties on the file in Windows the choosing the properties...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9837
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.