Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Running ppt slideshow in olecontainer



Permlink Replies: 2 - Last Post: May 2, 2017 2:33 AM Last Post By: Matthew Jones
Jorge Uriarte

Posts: 41
Registered: 11/28/14
Running ppt slideshow in olecontainer
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 1, 2017 11:32 AM
Hi there!

Using XE7. I have loaded an already existing powerpoint presentation onto an olecontainer within it's own form. I have added two buttons previous and next.
When I click to open presentation it opens in form with first slide visible. Great! My problem comes when trying to move from slide to slide. I click on the next button and it moves only to selected slide, but not as it's own slide. It opens in the powerpoint interface but still within the window.

Simply put I am looking for an example of how to move forward through the slides one by one and if needed how to move to the previous slide. I have spent many hours looking online for general help and have come up empty. I believe the answer is simple,but I haven't had any luck. What am I doing wrong or what do I need to add or change? Any help is greatly appreciated.

Many thanks!
***********************************************
var
form: Tform;
pres:olevariant;

procedure Tform.load_pptClick(Sender: TObject);
begin
with oc1 do begin //oc1 is the olecontainer
Parent := form; Left := 0; Top := 0;
Width := form.Width; Height := 312;
CreateObjectFromFile('C:\Users\Desktop\Presentation.ppsx', false);
Run;
pres:=oleobject;
end;
end;

procedure Tform.next_slideClick(Sender: TObject);
begin
oc1.DoVerb(ovShow);
Pres.Slides.Item(2).Select; //I have tried next options, but says it's not available in automation. Maybe it's just the format?
end;
Peter Below

Posts: 1,227
Registered: 12/16/99
Re: Running ppt slideshow in olecontainer
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 1, 2017 11:12 PM   in response to: Jorge Uriarte in response to: Jorge Uriarte
Jorge Uriarte wrote:

Hi there!

Using XE7. I have loaded an already existing powerpoint presentation
onto an olecontainer within it's own form. I have added two buttons
previous and next. When I click to open presentation it opens in
form with first slide visible. Great! My problem comes when trying
to move from slide to slide. I click on the next button and it moves
only to selected slide, but not as it's own slide. It opens in the
powerpoint interface but still within the window.

Simply put I am looking for an example of how to move forward through
the slides one by one and if needed how to move to the previous
slide. I have spent many hours looking online for general help and
have come up empty. I believe the answer is simple,but I haven't had
any luck. What am I doing wrong or what do I need to add or change?
Any help is greatly appreciated.

Many thanks!
***********************************************
var
form: Tform;
pres:olevariant;

procedure Tform.load_pptClick(Sender: TObject);
begin
with oc1 do begin //oc1 is the olecontainer
Parent := form; Left := 0; Top := 0;
Width := form.Width; Height := 312;
CreateObjectFromFile('C:\Users\Desktop\Presentation.ppsx', false);
Run;
pres:=oleobject;
end;
end;

procedure Tform.next_slideClick(Sender: TObject);
begin
oc1.DoVerb(ovShow);
Pres.Slides.Item(2).Select; //I have tried next options, but
says it's not available in automation. Maybe it's just the format?
end;

Sometimes it is easier to simply emulate user input to trigger actions
in an OLe server. Google for PostKeyEx32, that should turn up a
procedure to fake keyboard input. Use that to put PageUp and PageDn
keypresses into the message queue. If the OLE container has focus it
should pick them up and act accordingly.

--
Peter Below
TeamB

Matthew Jones

Posts: 337
Registered: 1/25/98
Re: Running ppt slideshow in olecontainer
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 2, 2017 2:33 AM   in response to: Jorge Uriarte in response to: Jorge Uriarte
Jorge Uriarte wrote:

Hi there!

Using XE7. I have loaded an already existing powerpoint presentation onto an olecontainer within it's own form. I have added two buttons previous and next.
When I click to open presentation it opens in form with first slide visible. Great! My problem comes when trying to move from slide to slide. I click on the next button and it moves only to selected slide, but not as it's own slide. It opens in the powerpoint interface but still within the window.

Simply put I am looking for an example of how to move forward through the slides one by one and if needed how to move to the previous slide. I have spent many hours looking online for general help and have come up empty. I believe the answer is simple,but I haven't had any luck. What am I doing wrong or what do I need to add or change? Any help is greatly appreciated.

All the information is out there, often in VB form, but it is very fiddly to get it right for all situations. I did activation of a separate PowerPoint, rather than embedded, but my "Next" code includes:

xPowerPointApp.ActivePresentation.SlideShowWindow.View.Next;
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02