|
#1
|
|
|
|
|
Hi,
I have office 2003 powerpoint with SP1 and I find that running the following code causes powerpoint to remain in memory Dim app As PowerPoint.Application Dim pres As PowerPoint.Presentation Set app = New PowerPoint.Application Set pres = app.Presentations.Open("c:\small.ppt", msoTrue, msoFalse, msoFalse) pres.Close app.Quit Set app = Nothing If I don't open a presentation, the app.Quit seems to quit the application properly. If I can explain why this is such a big deal to me, maybe someone can help with the solution: I absolutely *must* run a powerpoint ole process on a server (even though microsoft don't like it). Because I had problems doing that with with Word, I implemented a mechanism which identified the process ID of the winword.exe so that if the OLE operation got stuck (usually because word was trying to put up a dialog box) I could just kill the process from another thread. The only safe way to find out the process ID of the word ole server was to list all processes having the executable name "winword.exe" before and after creating the application object, then just take the difference. Now, the problem with powerpoint is that sometimes creating the application object will start up a new powerpnt.exe and sometimes it won't. so there is no simple way to identify the actual process. is this behaviour by design, a bug, or is it something specific to my installation? Andy |
|
|
|
#2
|
|
|
|
|
Andy,
You answered your own issue. PowerPoint is NOT a server application and if you solve this issue I can all but promice you there are a truck load more waiting for you. (BTDT) Sorry, MS is serious when they say it's not a server app. Austin Myers MS PowerPoint MVP Team PowerPoint Video and PowerPoint Sound Solutions www.pfcmedia.com "Andy Fish" <ajfish> wrote in message news:3180 [..] |
|
#3
|
|
|
|
|
well thanks for the reply but it's not particularly helpful
nothing in the world will stop me running powerpoint as a server. what I am after is the most stable way of doing it. "Austin Myers" <austinm> wrote in message news:a916 [..] |
|
#4
|
|
|
|
|
Andy,
You asked, I answered. In no way am I or anyone else going to try and stop you and I wish you luck in the effort. Austin Myers MS PowerPoint MVP Team PowerPoint Video and PowerPoint Sound Solutions www.pfcmedia.com "Andy Fish" <ajfish> wrote in message news:3756 [..] |
|
#5
|
|
|
|
|
In article <#V8Ok70yFHA.3180>, Andy Fish wrote:
> Hi, > > I have office 2003 powerpoint with SP1 and I find that running the following > code causes powerpoint to remain in memory > > Dim app As PowerPoint.Application > Dim pres As PowerPoint.Presentation > Set app = New PowerPoint.Application > Set pres = app.Presentations.Open("c:\small.ppt", msoTrue, msoFalse, > msoFalse) > pres.Close > app.Quit > Set app = Nothing > Is there other code around this, Andy? When I run just this fragment (from Excel in this case, with a reference set to PPT2003) it doesn't leave any open instances of PPT and PowerPnt.exe doesn't appear in the task list. Office SP1, Windows 2000, logged in with Admin privileges (which might have a bearing on the situation?) [..] > > Now, the problem with powerpoint is that sometimes creating the application > object will start up a new powerpnt.exe and sometimes it won't. so there is > no simple way to identify the actual process. > > is this behaviour by design, a bug, or is it something specific to my > installation? > > Andy > ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
|
#6
|
|
|
|
|
I can chime in from the Windows 2000, System Admin, running PowerPoint 2003
from VB and C++ not having any problems getting it to quit. "Steve Rindsberg" <abuse> wrote in message news:540a > In article <#V8Ok70yFHA.3180>, Andy Fish wrote: > > Hi, > > > > I have office 2003 powerpoint with SP1 and I find that running the following > > Is there other code around this, Andy? > > When I run just this fragment (from Excel in this case, with a reference set to [..] |
|
#7
|
|
|
|
|
So, we should support him on methods that MS says "Don't Do" and we
say "Don't Do". Must be some other bug in his code not capturing errors which is why MS says "Don't Do". Brian Reilly, MVP On Fri, 7 Oct 2005 13:15:18 -0400, "Mike M." <nospam> wrote: [..] |
|
#8
|
|
|
|
|
In article <qh5ek1tjn7ic5l749acjpp99a7mfv3ocfh>, MVP Brian Reilly
wrote: > So, we should support him on methods that MS says "Don't Do" and we > say "Don't Do". My point, and I think Mike's too, is that the code Andy posted works standalone in a non-server situation. If there's more to the code and if it can be made to fail in a non-server situation, then sure, let's do what we can to help. As to whether it can be made to work on a server, well ... There'd need to be a LOT more code to examine before one could even begin to guess what's going wrong. Then there's all the user permissions stuff and we're still back to the "MS doesn't support it" problem. > Must be some other bug in his code not capturing > errors which is why MS says "Don't Do". > > Brian Reilly, MVP > > On Fri, 7 Oct 2005 13:15:18 -0400, "Mike M." <nospam> > wrote: > ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
|
#9
|
|
|
|
|
Thanks very much for these replies.
Although my original code is c# running as a windows service, the code I posted was this was a straight cut and paste from a vb6 test program. However, seeing these replies made me go back and re-test it, and I discovered something a bit strange. In the case of vb6, I put the code in the form_load event and I have realised that powerpont.exe does indeed terminate but only when the form is actually displayed, not when you call app.Quit. (I had just been single-stepping it in the debugger so I never got as far as letting the form actually display. Curiously this behaviour happens even if you don't call app.Quit(). I tested similar code in a vbscript program with messageboxes in it, and this time the powerpnt.exe only terminates when the script finishes (presumably when cscript.exe terminates). So as usual, it's not quite as simple as it seems. I don't know what it is that makes powerpnt.exe decide to quit but it's definitely not the Quit function. maybe it's some kind of windows message or OLE housekeeping? Andy "Steve Rindsberg" <abuse> wrote in message news:ced8 [..] |
|
#10
|
|
|
|
|
You might want to search back a few months through this NG looking for messages
from Howard Kaikow. He's done quite a bit of testing on this issue of when and how PPT is instantiated and released under automation. In article <euIfco#yFHA.2960>, Andy Fish wrote: [..] > > So as usual, it's not quite as simple as it seems. I don't know what it is > that makes powerpnt.exe decide to quit but it's definitely not the Quit > function. maybe it's some kind of windows message or OLE housekeeping? > > Andy > > "Steve Rindsberg" <abuse> wrote in message > news:ced8 > ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
|
#11
|
|
|
|
|
Hi Andy, I use similar code in both VB and C++. My C++ app is a Windows
service that runs 7x24 with no user input. I crank up PowerPoint, generate a bunch of presentations and then quit PowerPoint every few minutes. I know MS says don't do this but I do it anyway. I have systems that have been running this way or 4 years so I guess the customer test mode is over now. Anyway, in either VB or C++ I don't see a problem. Prior to using PowerPoint 2002 we did have some problems with the reference count for PowerPoint 2000 and in some cases it wouldn't stop. It was before my time but there were some comments in the code indicating this problem and when I switch to 2002 I was able to put the code back. Here is how my c++ app releases PowerPoint including previous comments about issue: // Something about COM would not allow reattachment to PowerPoint // on the next run - just bail this out and leave everything // running for now. // I am going to re-instate this code with PPT 2002 they seem to have // fixed their reference count problems. if (m_pPowerPointActive) { try { m_pPowerPoint.Release(); } catch (_com_error e) { _bstr_t message = e.Description(); } m_pPowerPointActive = false; } } "Andy Fish" <ajfish> wrote in message news:2960 [..] |
|
#12
|
|
|
|
|
"Andy Fish" <ajfish> wrote in message
news:3756 > well thanks for the reply but it's not particularly helpful > > nothing in the world will stop me running powerpoint as a server. what I > am after is the most stable way of doing it. > What you can do is to call Marshal.ReleaseComObject on all of the objects for which you have a valid COM reference (a RCW), followed by 2 times (no kidding) GC.Collect and WaitForPendingFinalizers. Marshal.ReleaseComObject(app ) Marshal.ReleaseComObject(pres) GC.Collect() GC.WaitForPendingFinalizers() GC.Collect() GC.WaitForPendingFinalizers() This works reliably in an STA thread, but might fail in an MTA, so watch out for asp.net which by default runs in an MTA , the same goes for .NET authored Windows Services, which have their threads running in MTA. I have to agree with Austin, there is no reliable way to use Office applications server side (automated from a service or asp like stuff) and that's exactly why it's not supported. Willy. |
|
#13
|
|
|
|
|
Thanks, I've read the thread and it was very useful. It's interesting that
he doesn't mention the problem I have. I have tested this on another PC and get exactly the same symptoms. For vbscript and c# win forms application, powerpoint remains in memory until the application exits. for a vb6 app with the test code in the form_Load, powerpoint remains until the form is actually displayed. all this happens regardless of whether you call quit or not. I even incorporated Willy Denoyette's suggestions into my C# application but it didn't seem to make any difference. Now I've tested it on another PC I'm confident that my development environment is representative of a normal powerpoint installation, so at least I can engineer the solution and know that it stands a fighting chance of working on a customer site. Thanks also to Mike M for your encouraging comments about running it as a server in a live environment. Andy "Steve Rindsberg" <abuse> wrote in message news:2f27 [..] |
|
#14
|
|
|
|
|
Thanks Willy,
I incorporated this code into the form load event for a C# windows forms test application but powerpoint still remained in memory until after I closed the window (and hence exited the application). Anyway, as I said in another post below, I am happy that the behaviour is predictable so I will proceed with my development on this basis. Andy "Willy Denoyette [MVP]" <willy.denoyette> wrote in message news:3660 [..] |
|
#15
|
|
|
|
|
Good luck with it, Andy.
One other point that might prove useful - because PPT is single-instance, you don't need to worry about inadvertently sucking up resources by firing off multiple copies of it. If it's running already when you start an instance, you get the running instance, not a new one. ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
|
|
|
|
| Similar Threads | |
| Application.Quit but Word remains open in Task Manager Hello, I have writtwen the following routine, but depsite Word closing it remains open in the Task Manager, and so when AutoExec fires again it will not run befcuase Word is... |
|
| How to get doc. from 2000 powerpnt to 2003 powerpnt I made a power point presentation part on 2003 then the rest on 2000. Now that I want to work on it on the 2003 version it says that parts are missing. The missing parts are... |
|
| Automation: Excel with VSTO 1.1 remains in memory after Quit. If I open an Excel VSTO 1.1 workbook using VBScript (automation), the Excel process refused to quit and remains in memory after the Quit method. This work fine with normal... |
|
| Outlook 2000 sometimes remains in memory after calling Quit() Hi I'm developping a COM Addin for Outlook (2000/XP/2003) in C++. From my addin I am launching an installer to update the addin. After launching the installer, I close... |
|
|
All times are GMT. The time now is 06:20 PM. | Privacy Policy
|