- 6
- 0
- 约2.06万字
- 约 20页
- 2016-08-22 发布于河南
- 举报
Csharp的音乐播放类
MP3 类一
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace KJJ
class API
{
public const int WM_SYSCOMMAND = 0x112;
public const int SC_MOVE = 0xF010;
public const int HTCAPTION = 0x2;
[DllImportAttribute(user32.dll)]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImportAttribute(user32.dll)]
public static extern bool ReleaseCapture();
[DllImport(kernel32.dll, CharSet = CharSet.Auto)]
public static extern int GetShortPathName(string lpszLongPath, string shortFile, int cchBuffer);
[DllImport(winmm.dll, EntryPoint = mciSendString, CharSet = CharSet.Auto)]
public static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
}
}
MP3 类二
class Form32
{
public static void OpenAndPlay(string strFileName, bool flagRepeat)
{
string strCommand = ;
string buf = ;
strCommand = open \ + strFileName + \ alias music;
buf = buf.PadLeft(128, );
API.mciSendString(strCommand, buf, buf.Length, 0);
if (flagRepeat)
{ strCommand = play music repeat; }
else
{ strCommand = play music; }
API.mciSendString(strCommand, buf, buf.Length, 0);
}
public static void Play(bool flagRepeat)
{
string strCommand = ;
if (flagRepeat)
{ strCommand = play music repeat; }
else
{ strCommand = play music; }
API.mciSendString(strCommand, , 0, 0);
}
public static bool SetProcess(int nPosition)
{
bool success = false;
string strCommand = string.Format(seek music to {0}, nPosition);
if (API.mciSendString(strCommand, , 0, 0) == 0) { success = true; }
return succ
您可能关注的文档
最近下载
- 微网经济调度问题的混合整数规划方法.pdf VIP
- 河南成人2024学位英语考试真题及答案.docx VIP
- 长江中下游平原课件八年级地理下学期商务星球版.pptx VIP
- 商务星球版八年级地理下册长江中下游平原.pptx VIP
- 基于PLC的盾构机单液注浆系统设计_本科毕业设计(论文).doc VIP
- 黄浦区2011高考二模试卷及答案.doc VIP
- 常用草药验方手册(江西万年县革委会1970).pdf
- 长江中下游平原课件商务星球版地理八年级下册.pptx VIP
- 《长江中下游平原》教案-2025-2026学年商务星球版(新教材)初中地理八年级下册.pdf
- 北京市西城区2025一2026学年度第一学期期末含答案(9科试卷).pdf
原创力文档

文档评论(0)