Steve Rindsberg said:
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!