Important: Please read the Qt Code of Conduct -

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->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


  • 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?


Log in to reply