Hello,
i'm using qt 4.7.1 and MSVC++ 2008.
My problem, i can't connect to any interfaces of the windows media player, by activeX.
Small testprogramm
mediaplayer_simple.pro
TEMPLATE = app
CONFIG += qaxcontainer
HEADERS = playerwindow.h
SOURCES = main.cpp \
playerwindow.cpp
TEMPLATE = app
CONFIG += qaxcontainer
HEADERS = playerwindow.h
SOURCES = main.cpp \
playerwindow.cpp
To copy to clipboard, switch view to plain text mode
playerwindow.h
#ifndef PLAYERWINDOW_H
#define PLAYERWINDOW_H
#include <QWidget>
class PlayerWindow
: public QWidget{
public:
PlayerWindow();
private:
};
#endif
#ifndef PLAYERWINDOW_H
#define PLAYERWINDOW_H
#include <QWidget>
class QAxWidget;
class PlayerWindow : public QWidget
{
public:
PlayerWindow();
private:
QAxWidget *wmp;
};
#endif
To copy to clipboard, switch view to plain text mode
playerwindow.cpp
#include <QtGui>
#include <QAxWidget>
#include <QAxObject>
#include "playerwindow.h"
#include <windows.h>
#include <wmp.h>
PlayerWindow::PlayerWindow()
{
wmp->setControl("{6BF52A52-394A-11D3-B153-00C04F79FAA6}");
wmp->setProperty("URL", "D:/clock.avi");
qDebug("Version Info: %s", qPrintable(wmp->property("versionInfo").toString()));
IWMPMedia *media;
wmp
->queryInterface
(QUuid(IID_IWMPMedia
),
(void **)&media
);
if (media)
{
double dur;
media->get_duration(&dur);
qDebug("Duration 2 %f", dur);
media->Release();
}
else
{
qDebug("Failed");
}
}
#include <QtGui>
#include <QAxWidget>
#include <QAxObject>
#include "playerwindow.h"
#include <windows.h>
#include <wmp.h>
PlayerWindow::PlayerWindow()
{
wmp = new QAxWidget(this);
wmp->setControl("{6BF52A52-394A-11D3-B153-00C04F79FAA6}");
wmp->setProperty("URL", "D:/clock.avi");
qDebug("Version Info: %s", qPrintable(wmp->property("versionInfo").toString()));
IWMPMedia *media;
wmp->queryInterface(QUuid(IID_IWMPMedia), (void **)&media);
if (media)
{
double dur;
media->get_duration(&dur);
qDebug("Duration 2 %f", dur);
media->Release();
}
else
{
qDebug("Failed");
}
}
To copy to clipboard, switch view to plain text mode
main.cpp
#include <QApplication>
#include "playerwindow.h"
int main(int argc, char *argv[])
{
PlayerWindow playerWin;
playerWin.show();
return app.exec();
}
#include <QApplication>
#include "playerwindow.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
PlayerWindow playerWin;
playerWin.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Compiling failed, playerwindow.obj:: error: ... extern symbol "_IID_IWMPMedia" in Funktion ""public: __thiscall PlayerWindow::PlayerWindow(void)" (??0PlayerWindow@@QAE@XZ)".
Original german compiler Message -->
Verweis auf nicht aufgelöstes externes Symbol "_IID_IWMPMedia" in Funktion ""public: __thiscall PlayerWindow::PlayerWindow(void)" (??0PlayerWindow@@QAE@XZ)".
Something is wanting by the compiler, but i don't know what.
Anybody an idea?
Bookmarks