Powerpoint API calls slower than doing same stuff manually

G

Guest

Hello,
am writting an automation script for powerpoint. My script requires that it
opens powerpoint first time with visiblity of the ppt window set to false,
that is it operates on the document without dispaying the application window.
and second time visiblity set to true, that is application window should be
visible and user seeing the script operating of the document.

I am able to program both the ways, but the problem is when script is run
with powerpoint window "not visible", the same PPt APIs take more time than
when the powerpoint window "visible". The script follow same path of
execution in both the cases except setting the visible property of the
powerpoint to FALSE in first case.

As an eaxmple, if script opens a 5MB file when ppt window set to visible, it
takes only 800-1200 miliseconds and in second case it takes aroung 15-16
seconds.... ;o
 
G

Guest

One more point to add here.. in case2 the app should take more time as
compared to case1, because the rendering of objects on the screen is
involved? but its doing just the opposit.. its case1 that is taking more
time....
 
S

Steve Rindsberg

Hello,
am writting an automation script for powerpoint. My script requires that it
opens powerpoint first time with visiblity of the ppt window set to false,
that is it operates on the document without dispaying the application window.
and second time visiblity set to true, that is application window should be
visible and user seeing the script operating of the document.

I am able to program both the ways, but the problem is when script is run
with powerpoint window "not visible", the same PPt APIs take more time than
when the powerpoint window "visible". The script follow same path of
execution in both the cases except setting the visible property of the
powerpoint to FALSE in first case.

As an eaxmple, if script opens a 5MB file when ppt window set to visible, it
takes only 800-1200 miliseconds and in second case it takes aroung 15-16
seconds.... ;o

Very odd indeed. But to eliminate one possible red herring, is it the window
visible/not visible property that changes the load time or the order (that is,
first load of a given file is always slower than second)?
 
G

Guest

Steve Rindsberg said:
Very odd indeed. But to eliminate one possible red herring, is it the window
visible/not visible property that changes the load time or the order (that is,
first load of a given file is always slower than second)?

visible/not visible property do not take that time, its the open API itself
that seams to be taking this much time, as I figure it out as in following
block in my code..
----------------------------------------------

m_oPowerpoint.SetVisible( m_bVisible );
..
..
..
long t = GetTickCount();
m_oPresentation = m_oPresentations.Open(
m_File, //File Name
(long)FALSE,//Read-only
(long)FALSE,//Untitled
(long)m_bVisible //WithWindow
);
long timeTakenByPptAPI = GetTickCount() - t;
WRITE_2_LOG_FILE_LONG( timeTakenByPptAPI );
..
..
..
 
B

Brian Reilly, MVP

As an interesting test on this, I'd suggest trying the Windows API
call to freeze the window. If you don't have it available you can get
some sample code you could modify off Shyam's website
[email protected]

I have an app here that does a lengthy build in PPT from XL using the
trick to only make the app visible after the pressie is built. I'll
try and retest that over the weekend. If I do, I'll post the results.

Brian Reilly, MVP
 
G

Guest

did you really mean by freezing, switching of ScreenUpdate for window? I
followed the example given here(http://skp.mvps.org/ppt00033.htm) for Office
XP but don't know why this is not working for me (it seams to be not working
because "invisible" is taking the same amount of time and "visible" is
updating the screen as usual)..
---------
HWND h = FindWindow("PP10FrameClass", NULL);
if( LockWindowUpdate(h) == 0 )
{
AfxMessageBox("ERROR LockWindowUpdate(hwnd)");
}
else
{
// ? val = UpdateWindow(h);
}
 
G

Guest

Hi,
did anyone got any clues about the behavior of powerpoint appi's about
timmings? It will be very helpful for me. I have analysed the behavior of PPT
appis in terms of time taken to Open/Save/SaveAs the document of same size in
both visible and invisible state.. here are my findings about the timmings.

The timmings of the SaveAs API call are also surprisingly different in
visible and invisible states..Is it only the time for randering of objects?
doesn't look like that...

Time Taken by PowerPoint API Calls

File Size – 5MB

Operation Open Save Save As
v/s Time(ms)

Visible
Run 1 516 750 17843
Run 2 484 797 17562
Run 3 500 672 17484

Invisible
Run 1 15547 625 3593
Run 2 15453 1235 3141
Run 3 18031 1688 3234
Run 4 15500 640 3047
Run 5 15578 1266 2838
Run 6 15484 1547 4172
--

All runs were made on P4 2.9 GHz Win XP Machine

Regards,
msjammu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top