C # mcisendstring () enables Loop Playing of music

Source: Internet
Author: User

I declare that this is what I saw on the Microsoft Forum. Many people are searching for C # mcisendstring () loop playing music.
Learning English is important.

Using System;
Using System. runtime. interopservices;
Using System. text;
Using System. Windows. forms;

Namespace Playmp3withwindow
{
Public   Partial   Class Form1: Form
{
Public   Const   Int Mm_mcinotify =   0x3b9 ; // This is the command to declare that the music mcisendstring () is sent to the System

[Dllimport ( " Winmm. dll " )]
Private   Static   Extern   Long Mcisendstring ( String Command,
Stringbuilder returnstring,
Int Returnsize,
Intptr hwndcallback );
Public Form1 ()
{
Initializecomponent ();

Playsong (@"123.mp3");//When complete callback to defwndproc

//The path of the song. Play it at the beginning.

}

protected override void defwndproc ( ref message m)
{< br> base . defwndproc ( ref m );

If (M. MSG = mm_mcinotify) // determine whether the command is mm_mcinotify

// mcisendstring () mm_mcinotify command sent to the System
{< br> playsong ( @" 456.mp3 " ); // This is automatically played after broadcasting...
}< BR >}

Public   Void Playsong ( String File)
{
Mcisendstring ( " Close Media " , Null , 0 , Intptr. Zero ); // Close
Mcisendstring ( " Open \" "   + File +   " \ "Type mpegvideo alias Media " , Null , 0 , Intptr. Zero );

// The song that opens the file path ", type mpegvideo is the file type, alias is to alias the file as media
Mcisendstring ( " Play media venture y " , Null , 0 , This . Handle ); // Play
}

}
}

 SEO:Http://greatverve.cnblogs.com/archive/2011/06/24/mciSendString.html

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.