首页  编辑  

播放MP3

Tags: /C#/多媒体/   Date Created:

using System . Runtime . InteropServices;

public static uint SND_ASYNC = 0x0001 ;   // play asynchronously

public static uint SND_FILENAME = 0x00020000 ; // name is file name

[ DllImport ( "winmm.dll" )]

public static extern uint mciSendString( string lpstrCommand ,

    string lpstrReturnString, uint uReturnLength, uint hWndCallback);

private void button1_Click( object sender , EventArgs e)

{

   mciSendString( @"close temp_alias" , null , 0 , 0 );

   mciSendString( @"open ""E:\\alias temp_alias" ,

        null , 0 , 0 );

   mciSendString( "play temp_alias" , null , 0 , 0 ); // play temp_alias repeat

}