QAxObject Powerpoint



  • I have the code to start, run the presentation with 3 seconds delay and to quit. These all done with a single push button click..

    QString pptFile = "C:/embedded.pptx";
        CoInitialize(NULL);
        {
            QAxObject pp("PowerPoint.Application", nullptr);
            auto presentations = pp.querySubObject("Presentations");
            auto presentation =  presentations->querySubObject("Open(QString)", pptFile);
            auto slides = presentation->querySubObject("Slides");
    
            auto sliseshowsettings = presentation->querySubObject("SlideShowSettings");
            sliseshowsettings->dynamicCall("Run()");
            auto slideshowwindow = presentation->querySubObject("SlideShowWindow");
            auto slideshowview = slideshowwindow->querySubObject("View");
    
            int numSlides = slides->property("Count").toInt();
            for(int i = 1; i < numSlides; ++i) {
                    QThread::currentThread()->sleep(3);
                    slideshowview->dynamicCall("Next()");
            }
            QThread::currentThread()->sleep(3);
            pp.dynamicCall("Quit()");
        }
        CoUninitialize();
    

    What i want to do is...
    I have five push buttons...

    1.To start Powerpoint application
    2.To start slideshow with first slide
    3.To go to next slides
    4.To go to previous slides
    5.Finally to quit

    How to to do all the above functions for the same powerpoint application..
    Please help...
    Thanks in advance


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.