winword.exe does not exit after calling ReleaseDispatch()

V

Vineet Ahuja

Hello,
I am using win2000 with office 2000.
I perform some automation tasks on winword in my code
using MFC and COleDispatchDriver.
But even when I have released the IDispatch calling
m_bAutoRelease = TRUE; and ReleaseDispatch() I still have
winword.exe in my task manager.!!WHY??

Even in the microsoft
article:"http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dno2kta/html/offaut.asp" they have done
some thing like:
oWordApp.Quit(vOpt, vOpt, vOpt);
Which I do not want to do!!As it'll kill all other word
objects also which might be running in visible mode.!!

Help required!!
 
C

Cindy Meister -WordMVP-

Hi Vineet,
oWordApp.Quit(vOpt, vOpt, vOpt);
Which I do not want to do!!As it'll kill all other word
objects also which might be running in visible mode.!!
No, it should not. It should only affect the instance you
started up in your application, which is linked directly to
oWordApp. If you started your oWordApp and never made it
visible then you DO have to explicitly .Quit. Note that
Word, unlike Excel or Access, does not close itself done if
you release its object variable.

In any case, you do need to do what we in VB-speak call
"set the Word-objects to nothing". You have to release ALL
the pointers, explicitly, in the reverse order they were
created.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jan 24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
V

Vineet Ahuja

Hello Cindy,

So that means there is no way that winword.exe will vanish
until I call .Quit?

Yes I tried it with EXCELL and as I release the pointers
EXCEL.EXE also unloads!(no quits called!)
but not word!
very bad-:(
 
C

Cindy Meister -WordMVP-

Hi Vineet,

No, very good. Why shouldn't you want to call .Quit? You
should do it with Excel, too, in order to be correct. It's
only one additional line of code, and since it will only
affect the instance you started, and no other, there's no
problem, is there?

It's very good because often one wants to leave the user with
a document created with Automation so that he can work on it.
So that means there is no way that winword.exe will vanish
until I call .Quit?

Yes I tried it with EXCELL and as I release the pointers
EXCEL.EXE also unloads!(no quits called!)
but not word!
very bad-:(

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan
24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top