Controlling Windows Media Player 12 through QAxWidget



  • I am trying to control WMP12 through ActiveX with the following code:

     QAxWidget *wmp;
     wmp = new QAxWidget(this);
     wmp->setControl("{6BF52A52-394A-11D3-B153-00C04F79FAA6}");
     wmp->setProperty("URL", "C:/Users/qxf3567/Downloads/demoMedia/movie/00522M002M_VHS.MOV");
     qDebug("Version Info: %s", qPrintable(wmp->property("versionInfo").toString()));
     
     QAxObject *subObj = wmp->querySubObject("currentMedia()");
     qDebug("Duration %f", subObj->property("duration").toDouble());
    

    I get true as a result when setting the URL property and the version gets displayed correctly.

    However, the duration is always 0. I have double checked that the movie exists on my machine. What could be the problem?

    The output is:
    Version Info: 12.0.7601.18741
    Duration 0.000000

    Cheers,
    Mihai



  • It seems that the following call:
    qDebug("State: %s", qPrintable(wmp->property("playState").toString()));

    says the state is 9 which according to [1] means transitioning.

    How can one check if the player is ready ? Can anybody provide a code example please?

    [1] https://msdn.microsoft.com/en-us/library/windows/desktop/dd564085(v=vs.85).aspx


Log in to reply
 

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