Player created using the RealPlayer Control

Source: Internet
Author: User

 

This topic describes how to insertThe RealPlay control implements media file playback. The code runs as follows:



The following describes the specific implementation steps:

1. Create a dialog box-based program

2. Add ActiveX control of RealPlayer G2 control in the dialog box
(Project-> Add project-> compontent and controls-> registed ActiveX controls ).

3. In the dialog box, add the buttons and static text shown in the source program to control the open playback and other controls, and display the song information. Its ID number is shown in the source program.

4. Map Button messages with MFC

Void CSunapplerealplayerDlg: OnOpen ()
  
{
  
Char szFileFilter [] =
  
"RM File (*. rm) | *. rm |"
  
"Mp3 File (*. mp3) | *. mp3 |"
  
"MPEG File (*. mpeg) | *. mpeg |"
  
"Media File (*. asf) | *. asf |"
  
"Video File (*. dat) | *. dat |"
  
"MPGA File (*. mpga) | *. mpga |"
  
"Wave File (*. wav) | *. wav |"
  
"AVI File (*. avi) | *. avi |"
  
"Movie File (*. mov) | *. mov |"
  
"Mid File (*. mid; *, rmi) | *. mid; *. rmi |"
  
"Wma File (*. wma) | *. wma |"
  
"All File (*. *) | *. * | ";
  
 
  
CFileDialog dlg (TRUE, NULL, NULL, OFN_HIDEREADONLY, szFileFilter );
  
If (dlg. DoModal () = IDOK ){
  
CString PathName = dlg. GetPathName ();
  
PathName. MakeUpper ();
  
M_player-> SetSource (PathName );
  
M_player-> DoPlay ();
  
SetDlgItemText (ID

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.