Play media files with MCI

Source: Internet
Author: User

# include
# include
# pragma comment (Lib, "winmm. lib")

bool mci_play (lpctstr file)
{< br> // use mcisendcommand
mci_open_parms mciopen = {0};
mciopen. lpstrelementname = file;
mcierror = mcisendcommand (0, mci_open, mci_open_element, (DWORD) & mciopen);
If (mcierror)
{< br> char Buf [128];
mcigeterrorstring (mcierror, Buf, 128);
cstring mess_str;
mess_str.format ("Send mci_open command failed: % s/n", Buf);
afxmessagebox (mess_str);
return (false );
}< br>
mci_play_parms mciplay;
mcierror = mcisendcommand (mciopen. wdeviceid, mci_play, 0, (DWORD) & mciplay);
If (mcierror)
{< br> mcisendcommand (mciopen. wdeviceid, mci_close, 0, null);
afxmessagebox ("Send mci_play command failed/N");
return (false);
}

Return (true );
}

 

 

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.