473,548 Members | 2,604 Online
Bytes | Software Development & Data Engineering Community
+ 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
"....Howeve r, 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 5860
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.Releas eComObject(your PropertyReaderV ariable).

You can make a call to ReleaseComObjec t 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******** ******@TK2MSFTN GP14.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
"....Howeve r, 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 releaseCOMObjec t 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.Prope rtyReader

Dim docProperty As DSOleFile.Docum entProperties

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

DSO = New DSOleFile.Prope rtyReader

docProperty = DSO.GetDocument Properties(nome File)

docProperty.Cus tomProperties(" marco").Value = "rossi"

docProperty.Cus tomProperties(" stefano").Value = "sbrulli"

docProperty = Nothing

ReleaseComObjec t(DSO)

Dim mydoc As Word.Document

mydoc = MyWordApp.Docum ents.Open(FileN ame:=nomeFile, ReadOnly:=False ,
Format:=WdOpenF ormat.wdOpenFor matDocument)

Catch ex As Exception

MsgBox(ex.Messa ge)

End Try

Why?

thanks

Marco

"Mike McIntyre" <mi****@dotnets howandtell.com> ha scritto nel messaggio
news:uP******** ******@TK2MSFTN GP12.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.Releas eComObject(your PropertyReaderV a
riable).
You can make a call to ReleaseComObjec t 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******** ******@TK2MSFTN GP14.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
"....Howeve r, 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
15261
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 object handle. Waiting for the end of the script is aswell a bad option because the order in which the destructores are called does matter.
30
3698
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 = 111; cout<< sizeof(g)<<" "<<sizeof(double)<<" "<<sizeof(*g)<<" "<<*g<<" "<<endl;
7
6306
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 subclasses in a variable and call dispose(), but the Dispose() method of the base class is called rather than in the sub class example class baseclass...
4
1796
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, can a class instance destroy itself via one of it's own methods?
8
1941
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 anymore until I kill that process. Obviously, this is not acceptable. Looking back, I do not destroy any objects in my form. Would that be the reasn...
6
4014
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 tried using use sigtrap qw(handler DESTROY INT QUIT);, but I'm not even sure this is the proper way to catch the signal. Either way, it seems I no...
4
2932
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) { DateTime now = DateTime.Now;
4
2019
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
6509
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 some general information with an ok button. If I close the window using the window's close button I have no problems but If I call the same destroy...
0
7707
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. ...
0
7951
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7803
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...
0
6036
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...
0
5082
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3475
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1926
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
1
1051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.