🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: microsoft.public.office.developer.automation
11 messages
11 total messages Started by Roland Leisch Mon, 28 Feb 2005 15:21
Changing ActivePresentation
#4
Author: Roland Leisch
Date: Mon, 28 Feb 2005 15:21
30 lines
2494 bytes
Hello!

I have a very strange problem:

I try to change the active window (so change are applied to the right 
window if several windows are open) and therefore I wrote a method which 
searches for a special custom property and if it finds the needed one 
this presentation is activated (at last it should be!). The problem now 
is, that I cannont activate the presentations since Windows - Count is 0 
and I get an exception.

Can anybody give me a hint where the problem could be? My main problem 
is that I cant understand, why Windows collection can be 0 (I thought 
that at least one window has to be opened)?

Im using a Java-COM bridge to integrate Powerpoint in an ole container 
within my Java application.



Thanks in advance!


Source:
((_PresentationImpl) presentations.item(new 
Variant(1))).getWindows().item(new Int(1)).activate();

I thought that this piece of code should work alsways since there has 
always to be a least one presentation and one window but there is an 
exception thrown in getWindows since count is zero?!?
Re: Changing ActivePresentation
#5
Author: Steve Rindsberg
Date: Mon, 28 Feb 2005 19:43
37 lines
2537 bytes
In article <1109601286.547140@news.liwest.at>, Roland Leisch wrote:
> Hello!
> 
> I have a very strange problem:
> 
> I try to change the active window (so change are applied to the right 
> window if several windows are open) and therefore I wrote a method which 
> searches for a special custom property and if it finds the needed one 
> this presentation is activated (at last it should be!). The problem now 
> is, that I cannont activate the presentations since Windows - Count is 0 
> and I get an exception.
> 
> Can anybody give me a hint where the problem could be? My main problem 
> is that I cant understand, why Windows collection can be 0 (I thought 
> that at least one window has to be opened)?
> 
> Im using a Java-COM bridge to integrate Powerpoint in an ole container 
> within my Java application.
> 
> Thanks in advance!
> 
> Source:
> ((_PresentationImpl) presentations.item(new 
> Variant(1))).getWindows().item(new Int(1)).activate();
> 
> I thought that this piece of code should work alsways since there has 
> always to be a least one presentation and one window but there is an 
> exception thrown in getWindows since count is zero?!?

Unless other code forces it, there doesn't have to be at least one 
presentation.  Might that be the problem?

--
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Re: Changing ActivePresentation
#6
Author: Roland Leisch
Date: Tue, 01 Mar 2005 08:08
16 lines
2250 bytes
> Unless other code forces it, there doesn't have to be at least one 
> presentation.  Might that be the problem?

Hello!

Thanks for yyour answer but Im sorry I didnt understand it. My Problem 
is that if I start 2 instances of my application (each one contains an 
ole container with and powerpoint presentation) only the last started 
instance reacts to any commands. So I want to activate the first 
instance to be able to exectue methods on this one.

So I wrote a method which identifies the right instance (ole container 
with presentation) and now I have to activate this one. But that doesnt 
work since Windows-Count is zero and I cant execute activate method!

Thanks in advance!
Re: Changing ActivePresentation
#7
Author: Steve Rindsberg
Date: Tue, 01 Mar 2005 16:20
54 lines
2801 bytes
In article <1109661686.51153@news.liwest.at>, Roland Leisch wrote:
> > Unless other code forces it, there doesn't have to be at least one 
> > presentation.  Might that be the problem?
> 
> Hello!
> 
> Thanks for yyour answer but Im sorry I didnt understand it. 

Hi Roland, 

No worries.  I'm probably misunderstanding your question too. ;-)
But I was responding to this:

=========
Source:
((_PresentationImpl) presentations.item(new 
Variant(1))).getWindows().item(new Int(1)).activate();

I thought that this piece of code should work alsways since there has 
always to be a least one presentation and one window but there is an 
exception thrown in getWindows since count is zero?!?
============

I'm probably mistaken, but it looks like you're referencing 

Presentions.Item(some_number)

But if there are no presentations open, there can be no 
Presentations.Item(anything)




My Problem 
> is that if I start 2 instances of my application (each one contains an 
> ole container with and powerpoint presentation) only the last started 
> instance reacts to any commands. So I want to activate the first 
> instance to be able to exectue methods on this one.
> 
> So I wrote a method which identifies the right instance (ole container 
> with presentation) and now I have to activate this one. But that doesnt 
> work since Windows-Count is zero and I cant execute activate method!
> 
> Thanks in advance!
>




--
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Re: Changing ActivePresentation
#13
Author: Roland Leisch
Date: Sat, 05 Mar 2005 09:52
15 lines
2292 bytes
> I'm probably mistaken, but it looks like you're referencing 
> 
> Presentions.Item(some_number)
> 
> But if there are no presentations open, there can be no 
> Presentations.Item(anything)

Ok - now I understand what you mean! But I open a presentation 
programatically and it is displayed in the ole container and it is NOT 
closed - so I thought Windows-Count has alwayys to be at least 1 until I 
close the presentation. Nevertheless the Windows-Count is still zero.

The very strange thing is that this behavior only occours if I open a 
second ole contianer containing a powerpoint presentation. With only one 
ole container everything works fine!
Re: Changing ActivePresentation
#14
Author: Steve Rindsberg
Date: Sat, 05 Mar 2005 21:10
36 lines
2874 bytes
In article <1110013549.787152@news.liwest.at>, Roland Leisch wrote:
> > I'm probably mistaken, but it looks like you're referencing 
> > 
> > Presentions.Item(some_number)
> > 
> > But if there are no presentations open, there can be no 
> > Presentations.Item(anything)
> 
> Ok - now I understand what you mean! But I open a presentation 
> programatically and it is displayed in the ole container and it is NOT 
> closed - so I thought Windows-Count has alwayys to be at least 1 until I 
> close the presentation. Nevertheless the Windows-Count is still zero.
> 
> The very strange thing is that this behavior only occours if I open a 
> second ole contianer containing a powerpoint presentation. With only one 
> ole container everything works fine!

Hmmm.  I've only played briefly with PPT shows in an OLE container, but a 
couple things strike me as worth looking at:

While the container isn't activated, there wouldn't be any instance of PPT, so 
any reference to a PPT object would throw an error.  That's probably obvious to 
you, so pardon my mentioning it.  ;-)

But another point:  PowerPoint is a single-instance application.  You can't 
have two copies of the same version running at once.  How that affects what 
happens to presentations in an OLE container, I don't know, but  .... who 
knows, maybe it's relevant?



--
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Re: Changing ActivePresentation
#16
Author: Roland Leisch
Date: Sun, 06 Mar 2005 19:24
19 lines
2532 bytes
  > While the container isn't activated, there wouldn't be any instance 
of PPT, so
> any reference to a PPT object would throw an error.  That's probably obvious to 
> you, so pardon my mentioning it.  ;-)

Hmm.. the strange thing is that Windows-Count first is 1 and only after 
I open a second instance of my application containing an ole container 
Windows-Count is 0.


> But another point:  PowerPoint is a single-instance application.  You can't 
> have two copies of the same version running at once.  How that affects what 
> happens to presentations in an OLE container, I don't know, but  .... who 
> knows, maybe it's relevant?

Only one instance of powerpoint.exe is in memory (at least taskmamager 
tells me that) and presentations-collection contains both presentations.

So everything is quite unclear!
Re: Changing ActivePresentation
#17
Author: Steve Rindsberg
Date: Mon, 07 Mar 2005 00:16
13 lines
1682 bytes
> 
> So everything is quite unclear!
>

THAT certainly sums it up well. <g>

Here's hoping somebody else has an idea that'll help.  I'm fresh out.  

--
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Problem with Zoom and Windows count in Excel 2002
#18
Author: Roland Leisch
Date: Tue, 08 Mar 2005 09:46
30 lines
2959 bytes
Hello!

I have posted the problem before but there were some misunderstanding so 
I will post again:

I have an application which uses an ole container to display an excel 
workbook. In my application I have a menubar in which I can change Zoom 
settings for the contained workbook (since I prohibited any interaction 
on the workbook itself as I want it only to be displayed and not be 
changed in any way).

If I start my application I can change the zoom settings without any 
problems.

But if a start my application a second time (with an other workbook) Im 
not able to change any settings in the first workbook (I can click on my 
entries but nothing happens).

So I tried to implement a workaround: I add custom document properties 
which allow me to identify the open workbooks. I iterate all workbooks 
and if I find the right workbook I call workbook.activate(lcid).

The very strange thing is that this works only if one instance of my 
application is open - if a second instance is running I get: COM object 
method returns error code: 0x800A03EC and only the last started instance 
reacts - the first instance gives me the 0x800A03EC error.

Has anybody here got an idea where the problem could be?

Thanks in advance!
Re: Changing ActivePresentation - SOLVED
#3
Author: Roland Leisch
Date: Thu, 10 Mar 2005 13:23
21 lines
2268 bytes
Steve Rindsberg wrote:
>>So everything is quite unclear!
>>
> 
> 
> THAT certainly sums it up well. <g>
> 
> Here's hoping somebody else has an idea that'll help.  I'm fresh out.  
> 
> --
> Steve Rindsberg, PPT MVP
> PPT FAQ:  www.pptfaq.com
> PPTools:  www.pptools.com
> ================================================
> 


I found a workaround and until now it works:

Whenever I want to activate a file in an ole container I call 
OleContainer.doVerb(SHOW) and everything is fine!
Re: Changing ActivePresentation - SOLVED
#2
Author: Steve Rindsberg
Date: Thu, 10 Mar 2005 18:38
17 lines
1816 bytes
> 
> I found a workaround and until now it works:
> 
> Whenever I want to activate a file in an ole container I call 
> OleContainer.doVerb(SHOW) and everything is fine!
>

Roland, thanks for posting back with that.  I'm sure it'll save somebody else 
hours of work later.  


--
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads