quiting powerpoint application in .net

S

Savan Gandhi

Hi,
I am using following code for quitting powerpoint application in .net:

======================================================

pptApp.Quit()

Marshal.FinalReleaseComObject(pptApp)

pptApp = Nothing

GC.Collect()

log.Warn("GC-1 complete")

GC.WaitForPendingFinalizers() // It freezes here.

log.Warn("GC-1 finalizer complete")

pptApp = New PowerPoint.Application

Dim v As String = pptApp.Version()

log.Info("Instantiate PowerPoint " & v)

For Each pptProcess As Process In Process.GetProcessesByName("POWERPNT")

log.Warn("powerpnt process id: " & pptProcess.Id) // Here the process id should be different than the older one.

Next

=====================================================

The problem is code freezes at the mentioned line. When I open powerpnt from windows explorer there is no dialog box which could have been a reason for causing this. GC.collect() & waitforpendingfinalizers() are necessary for releasing powerpnt application. The above code works on few machines and not on others. Any help appreciated.

Thanks,

Savan
 

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