VC2008 the use of Windows Media player controls (ii)

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.