If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#21
|
|||
|
|||
"Mike M." wrote in message
... My app has been doing what Steve suggests for almost 4 years without any reports of problems. There is one and only one instance of Powerpoint (powerpnt.exe) running regardless of how many programs have a reference count to it or if a user opened the GUI for Powerpoint. I check to make sure that presentations count = 0 then I call the Powerpoint quit method. If a user has started the GUI and closed the pres1 (or whatever) default presentation Powerpoint creates then indeed when you quit PowerPoint it closes the GUI. If other programs have connected to that instance of Powerpoint then they would get an exception when they referenced that object. But that is why there is a big disclaimer on the MS web site that tells us not to use Powerpoint in an automated fashion. We are pretty much out there on our own. I had originally hoped they would expose the reference count through a method or property but I didn't see it. It seems that the problem can be solved by enumerating processes. |
#22
|
|||
|
|||
---------------------------- I was using the wrong terminology. PowerPoint is a Multi-use, single Instance app. I guess I'm not grasping the meaning of Multi-use in this context. |
#23
|
|||
|
|||
see kb article 288902
-- http://www.standards.com/; See Howard Kaikow's web site. "Steve Rindsberg" wrote in message ... ---------------------------- I was using the wrong terminology. PowerPoint is a Multi-use, single Instance app. I guess I'm not grasping the meaning of Multi-use in this context. |
#24
|
|||
|
|||
In article , Howard Kaikow wrote:
288902 Thanks, Howard. That still leaves me puzzled, though. It refers to "Instancing" as having one of two values, Single- or MultiUse. It doesn't refer to Instancing as a property distinct from those two. And either I'm missing the kick in the head that triggers the AHA or the article is wrong. It says: "Depending on whether the server is designed as SingleUse or MultiUse, another server process may or may not be launched." It doesn't say which is which, but it seems reasonable to assume that "MultiUse" = "another server may be launched". It then goes on to say that Excel and Word are SingleUse, which doesn't seem right to me. Rather, it seems to have reversed the values. It does raise an interesting point that reinforces your thoughts, though: we've been talking about user- and your_code-initiated instances of PPT, but there might also be an instance initiated by the user or code activating a PPT object (slide or presentation) from within another app. The fun never ends. ;-) If it's possible to identify and stop individual processes independent of the application instance itself, it sounds as though you're onto a possible solution to the problem. ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
#25
|
|||
|
|||
Steve, I think this terminology goes against the grain. Sort of like
Unicast and Multicast in streaming video. MultiUse means that multiple users attach to the single instance server. SingleUse means each user gets their own instance of the server. AHA? "Steve Rindsberg" wrote in message ... In article , Howard Kaikow wrote: 288902 Thanks, Howard. That still leaves me puzzled, though. It refers to "Instancing" as having one of two values, Single- or MultiUse. It doesn't refer to Instancing as a property distinct from those two. And either I'm missing the kick in the head that triggers the AHA or the article is wrong. It says: "Depending on whether the server is designed as SingleUse or MultiUse, another server process may or may not be launched." It doesn't say which is which, but it seems reasonable to assume that "MultiUse" = "another server may be launched". It then goes on to say that Excel and Word are SingleUse, which doesn't seem right to me. Rather, it seems to have reversed the values. It does raise an interesting point that reinforces your thoughts, though: we've been talking about user- and your_code-initiated instances of PPT, but there might also be an instance initiated by the user or code activating a PPT object (slide or presentation) from within another app. The fun never ends. ;-) If it's possible to identify and stop individual processes independent of the application instance itself, it sounds as though you're onto a possible solution to the problem. ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
#26
|
|||
|
|||
"Steve Rindsberg" wrote in message
... In article , Howard Kaikow wrote: 288902 Thanks, Howard. That still leaves me puzzled, though. It refers to "Instancing" as having one of two values, Single- or MultiUse. It doesn't refer to Instancing as a property distinct from those two. And either I'm missing the kick in the head that triggers the AHA or the article is wrong. It says: "Depending on whether the server is designed as SingleUse or MultiUse, another server process may or may not be launched." It doesn't say which is which, but it seems reasonable to assume that "MultiUse" = "another server may be launched". It then goes on to say that Excel and Word are SingleUse, which doesn't seem right to me. Rather, it seems to have reversed the values. It does raise an interesting point that reinforces your thoughts, though: we've been talking about user- and your_code-initiated instances of PPT, but there might also be an instance initiated by the user or code activating a PPT object (slide or presentation) from within another app. The fun never ends. ;-) If it's possible to identify and stop individual processes independent of the application instance itself, it sounds as though you're onto a possible solution to the problem. Yes, MSFT's terminology can be confusing. I added to the confusion by initially using the wrong terminology. MSFT appears to use that terminology consistently in various KB articles. In effect, it means that for PowerPoint, there is a single instance of the program running, as you can see if you look at the Task Manager, but there may be multiple uses of that instance. For, say Word, you can have multiple instances of Word running, which you can see in the Task Manager. After my code works with Powerpoint, if the code has created a NEW instance of PowerPoint, i.e,, no other PPT had been running, then the code has to determine whether it is safe to Quit PPT. I only do this, because in the code of interest, I have no need to leave any Presentation active. For the latterm the issue is not relevant, I'd just let PPT live! At some point, I need to examine the running processes to determine whether anybody else started using PPT AFTER I created the NEW instance. The logic of the solution is straight-forward. The only issue is how to do it. I found a number of examples in the MSFT KB, one at ALLAPI, and one in Steve Roman's API book that demonstrate how to use EnumProcesses, so I think I can do this. One disappointment is that PSAPI.DLL is supported only on NT/2000/XP. Other mechanisms are available for Win 95/Win 98/Win Me. Unfortunately, I no longer have a Win 98 system and my ancient Win 95 system does not have the resources to run a VBA version of PPT. So, I will include code to detect the OS and prevent the PPT stuff from runniing on other OS, or warn the user that they cannot run code that starts PPT until AFTER my PPT code has completed, unless PPT was already running. I'll be disabling keyboard and mouse input during the interval my code needs to decide whether to Quit PPT, so the user will not be able to start PPT from the desktop during the very short interval my code is deciding whether to Quit PPT. Yes, I am a masochist! |
#27
|
|||
|
|||
"Mike M." wrote in message
... Steve, I think this terminology goes against the grain. Sort of like Unicast and Multicast in streaming video. MultiUse means that multiple users attach to the single instance server. SingleUse means each user gets their own instance of the server. AHA? Terminology is in the eye of the beholder, heck, I still think that "PC" means "plug compatible", not "imPersonal Computer". |
#28
|
|||
|
|||
In article , Mike M. wrote:
Steve, I think this terminology goes against the grain. Sort of like Unicast and Multicast in streaming video. MultiUse means that multiple users attach to the single instance server. SingleUse means each user gets their own instance of the server. AHA? AHA! Only Microsoft ... shakes head .... Your passion is the software that inspires use to make it imparsible. |
#29
|
|||
|
|||
After my code works with Powerpoint, if the code has created a NEW instance
of PowerPoint, i.e,, no other PPT had been running, then the code has to determine whether it is safe to Quit PPT. I only do this, because in the code of interest, I have no need to leave any Presentation active. For the latterm the issue is not relevant, I'd just let PPT live! I'm caught up on that end of things. It was the confusion over multi/single that set me back a notch or two. g One other possibility (another KB article says this won't work with PPT97, not sure of later versions, and that might be a deal-breaker for you, but ...) If you use CreateObject("PowerPoint.Application") it launches PPT if PPT isn't already running, gives you a ref to the running copy otherwise. And if you set the ref to nothing, PowerPoint goes away IF your code launched it. If it was alive first, it seems to stay alive after. If you invoke PPT then somebody else does, then you quit, it still stays alive. I've poked at it a bit this evening and it seems to work. How widely/reliably I can't promise. The bug on PPT 97 is referenced in one of the links from that same 288902 article. If that works, it could save lots of APIdiving. Unfortunately, I no longer have a Win 98 system and my ancient Win 95 system does not have the resources to run a VBA version of PPT. If you run into this problem often, a copy of Virtual PC or VMWare is a wonderful investment. One PC, multiple operating systems. Yes, I am a masochist! You've fallen in among people who write code to automate PPT. You fit right in. ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
#30
|
|||
|
|||
I also use C++ to automate PowerPoint and initially I was having a problem
with getting PowerPoint to go away after I closed my reference to it. That was using PPT 2000. I didn't have any trouble (well, that specific trouble) once I started using PPT 2002. I vaguely remember thinking there was a problem with the reference counting in that version of PPT but it might just be a bad sector in my memory or bad programming. I am becoming more susceptible to both. "Steve Rindsberg" wrote in message ... After my code works with Powerpoint, if the code has created a NEW instance of PowerPoint, i.e,, no other PPT had been running, then the code has to determine whether it is safe to Quit PPT. I only do this, because in the code of interest, I have no need to leave any Presentation active. For the latterm the issue is not relevant, I'd just let PPT live! I'm caught up on that end of things. It was the confusion over multi/single that set me back a notch or two. g One other possibility (another KB article says this won't work with PPT97, not sure of later versions, and that might be a deal-breaker for you, but ...) If you use CreateObject("PowerPoint.Application") it launches PPT if PPT isn't already running, gives you a ref to the running copy otherwise. And if you set the ref to nothing, PowerPoint goes away IF your code launched it. If it was alive first, it seems to stay alive after. If you invoke PPT then somebody else does, then you quit, it still stays alive. I've poked at it a bit this evening and it seems to work. How widely/reliably I can't promise. The bug on PPT 97 is referenced in one of the links from that same 288902 article. If that works, it could save lots of APIdiving. Unfortunately, I no longer have a Win 98 system and my ancient Win 95 system does not have the resources to run a VBA version of PPT. If you run into this problem often, a copy of Virtual PC or VMWare is a wonderful investment. One PC, multiple operating systems. Yes, I am a masochist! You've fallen in among people who write code to automate PPT. You fit right in. ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to put powerpoint inside of powerpoint? (picture in picture?) | Jwolfer | Powerpoint | 5 | January 28th, 2005 11:37 PM |
Limit Outlook to one single instance | Tito | General Discussion | 1 | January 14th, 2005 07:11 PM |
PowerPoint Presentation in Word document! | Kumar | General Discussion | 2 | May 21st, 2004 01:26 PM |
multiple custom spell-check dictionaries with word and powerpoint | Steve | New Users | 1 | May 2nd, 2004 10:40 AM |
Multiple Charts from single instance of data | dvt | Charts and Charting | 1 | September 21st, 2003 01:45 PM |