Introduction to the MCI programming of Windows multimedia programming

Source: Internet
Author: User

MCI, a high-level interface for controlling multimedia devices under Windows, defines functions and data types that call MCI functionality in <mmsystem.h>, which provides a set of device-independent APIs for controlling multimedia devices.

The application controls the MCI device by sending a command message to the MCI device.
The following code implements the ability to play MP3 playback with MCI:

#include <Windows.h>

The header file to include and the linked library.

#include <mmsystem.h> #pragma Comment(lib,"Winmm.lib") BOOL playfile(TCHAR* szfilepath) { mci_open_parms mciopen; mcierror mcierror; mciopen. Lpstrdevicetype = "MPEGVideo" ; mciopen. Lpstrelementname = Szfilepath ;    //OpenMCIEquipment mcierror = mcisendcommand(0,mci_open, mci_open_type | mci_open_element , (DWORD) & Mciopen ); if (mcierror!=0) return FALSE; UINT DeviceID = mciopen. Wdeviceid ; mci_generic_parms mcigeneric; mcierror=mcisendcommand(DeviceID,Mci_window , 0, (DWORD) &mcigeneric); if (mcierror!=0) return FALSE; mci_play_parms mciplay;     //Play mcierror = mcisendcommand(DeviceID,mci_play , 0 , (DWORD) & Mciplay ); if (mcierror!=0) return FALSE; return TRUE; }int _tmain(int argc, _tchar* argv[]) { BOOL bisplaying=playfile("e:\\ Music-Songs\\ji jing\\the freedom of Loneliness. mp3 ");While (bisplaying)     { Sleep(+);     } return 0; }

Introduction to the MCI programming of Windows multimedia programming

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.