Operating system: Windows 7
Software Environment: Visual C + + 2008 SP1
This purpose: A practical article on the use of Windows Media player controls under VC2008
Strangely, it may be a problem with the WMP.DLL file, although Windows Media Player is normal, but when you insert the Windows Media Player control in VC2008, you cannot find the class for the control when you want to add a class to the control, as follows:
This article describes a common way to accomplish the implementation of the Windows Media Player control. First, all the classes (24) of the Windows Media Player control are downloaded here, and you can see why I generated all the classes at that time. Now add those classes to the project, which is still added as needed, but CWMPPlayer4.h and CWMPPlayer4.cpp are best added because they are connected to audio and video. Click "Project" → "Add Existing Item", select the desired class, "add" complete.
The next step is to add the header file, declare the control object, and bind the control.
Add #include "CWMPPlayer4.h" to the TestDlg.h header file,
Then declare CWMPPlayer4 m_player;
And then in TestDlg.cpp: the implementation file
void Ctestdlg::D odataexchange (cdataexchange* pDX) {CDialog::D odataexchange (PDX); DDX_Control (PDX, Idc_button1, M_open); DDX_Control (PDX, idc_ocx1, m_player);/Bind player Control}
Finally, we can test, in this project I added a button to achieve the open playback.
void Ctestdlg::onbnclickedbutton1 () {//TODO: Add control Notification Handler code M_player.put_url (_t ("e://music//ringtones//Good happiness (ringtones). mp3"));}
The effect has come out, as for the rest of the control of the player, such as: open, play, pause, fast-forward and so on, the next will be introduced.
Windows Media Player Control class Packaging: http://download.csdn.net/source/1856942