473,480 Members | 3,062 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

destroy an object is possible?

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 terminates....."
Now I 'm not able to destroy the object so if I try to open the document
immediately after, a message error occurs (the file is used).
I tried to use the garbage collector
GC.Collect
but sometime the document is still used.
It's possible that don't exists a way to destroy the propertyReader object?

Thank you
Marco


Nov 21 '05 #1
2 5849
Hi Marco,

That MSDN article is for VB6 but I see you are using GC.Collect. Are you
trying to use DSOFile.dll in VB.NET?

If so check out
System.Runtime.InteropService.Marshall.ReleaseComO bject(yourPropertyReaderVariable).

You can make a call to ReleaseComObject as soon as you are finished with the
reader.
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"Marco" <co***@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP14.phx.gbl...
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 terminates....."
Now I 'm not able to destroy the object so if I try to open the document
immediately after, a message error occurs (the file is used).
I tried to use the garbage collector
GC.Collect
but sometime the document is still used.
It's possible that don't exists a way to destroy the propertyReader
object?

Thank you
Marco

Nov 21 '05 #2
Hello,
yes I use the dsofile.dll with VB.NET.
I tried with releaseCOMObject but the problem is not resolved.
When I open the document that I have modified with the propertyReader an
error occurs.

Try
Dim DSO As DSOleFile.PropertyReader

Dim docProperty As DSOleFile.DocumentProperties

Dim nomeFile As String = "C:\prova\1999dlg135_3.doc"

DSO = New DSOleFile.PropertyReader

docProperty = DSO.GetDocumentProperties(nomeFile)

docProperty.CustomProperties("marco").Value = "rossi"

docProperty.CustomProperties("stefano").Value = "sbrulli"

docProperty = Nothing

ReleaseComObject(DSO)

Dim mydoc As Word.Document

mydoc = MyWordApp.Documents.Open(FileName:=nomeFile, ReadOnly:=False,
Format:=WdOpenFormat.wdOpenFormatDocument)

Catch ex As Exception

MsgBox(ex.Message)

End Try

Why?

thanks

Marco

"Mike McIntyre" <mi****@dotnetshowandtell.com> ha scritto nel messaggio
news:uP**************@TK2MSFTNGP12.phx.gbl...
Hi Marco,

That MSDN article is for VB6 but I see you are using GC.Collect. Are you
trying to use DSOFile.dll in VB.NET?

If so check out
System.Runtime.InteropService.Marshall.ReleaseComO bject(yourPropertyReaderVa
riable).
You can make a call to ReleaseComObject as soon as you are finished with the reader.
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"Marco" <co***@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP14.phx.gbl...
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 terminates....."
Now I 'm not able to destroy the object so if I try to open the document
immediately after, a message error occurs (the file is used).
I tried to use the garbage collector
GC.Collect
but sometime the document is still used.
It's possible that don't exists a way to destroy the propertyReader
object?

Thank you
Marco

Nov 21 '05 #3

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

Similar topics

1
15252
by: Thomas Ilsche | last post by:
Hi, how do I "explicitly destroy" an Object in PHP5 to make sure the destructor is called an the object destroyed? unset is not an option because there are multiple variables containing the...
30
3687
by: jimjim | last post by:
Hello, This is a simple question for you all, I guess . int main(){ double *g= new double; *g = 9; delete g; cout<< sizeof(g)<<" "<<sizeof(double)<<" "<<sizeof(*g)<<" "<<*g<<" "<<endl; *g =...
7
6299
by: Claire | last post by:
How do I make sure Ive disposed of my objects please? Ive added interface IDispose to a base class. Ive several sub classes inheriting from this base class. I store one or other of these...
4
1785
by: Peter Oliphant | last post by:
I'd like to be able to destroy a Timer in it's own event handler. That is, within it's tick handler I'd like to delete the Timer itself (e.g., for one-shot timers). Is this possible? In general,...
8
1929
by: vvenk | last post by:
Hello: I just wrote my first ASP.Net application. It worked fine on my machine and when I put into production, the ASP.Net process reaches 50% quite fast and then the system does not work...
6
4005
by: muppetjones | last post by:
I'm pretty new at this, and I'm trying to figure out how Perl's classes work with signals. Specifically, it doesn't seem that a class's DESTROY function is called when you Ctrl-C the program. I...
4
2923
by: Curious | last post by:
Hi, I have a timer object that's launched as below: mTimer = new System.Threading.Timer (new TimerCallBack(SubscribeTrade), null, 15000, 15000); void SubscribeTrade (object state) {...
4
2014
by: Juergen-Bernhard Adler | last post by:
Hello, pretend some noob has (in a fake-static class) provided the following method public static kill_object($obj) { if (!is_object($obj)) return false;
3
6498
by: drzoo2 | last post by:
Completely noob question as I am not a programmer but really trying hard to learn Python (Object oriented programming in general). I am writing a program in python that calls a popup window with...
0
7060
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,...
0
7022
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...
0
5365
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,...
1
4799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3013
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...
0
3004
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1311
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 ...
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
206
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...

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.