如何利用C#编写播放midi音乐程序 最近遇到问题甚多,原因在于自己基础不好,望各位高手相助,在先谢过…… 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System;using System.Text;using System.Runtime.InteropServices;namespace Music{ /**//// <summary> /// /// </summary> public class Audio { [DllImport("winmm.dll")] private static extern int mciSendString ( string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback ); [DllImport("kernel32.dll", CharSet = CharSet.Auto)] public static extern int GetShortPathName ( [MarshalAs(UnmanagedType.LPTStr)] string path, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder shortPath, int shortPathLength ); public Audio() { } public void Play(string FileName) { StringBuilder shortPathTemp = new StringBuilder(255); int result = GetShortPathName(FileName, shortPathTemp, shortPathTemp.Capacity); string ShortPath = shortPathTemp.ToString(); mciSendString("open "+ShortPath+" alias song","",0,0); mciSendString("play song","",0,0); } public void Stop() { mciSendString("stop song","",0,0); } public void Pause() { mciSendString("pause song","",0,0); } public void Close() { mciSendString("close song","",0,0); } }} C#连接oracle(急) (新手跪求解。)关于学java学c#,方向asp.net和jsp的问题 2个xml的问题(高手出来一下) c#中字符串格式化的问题 商品进销存系统,支持各种卖家,如何设计更合理? 如何在Pocket PC上使用自定义控件,急,在线等! 请问哪里有清华的<<C#大学教程>> 下载? 大家来帮忙做做面试题目2 安装vs2010后无法安装sql2008 网络文件传输的问题 急求向Word2003文件中插入图片的方法!在线急等!!!!!!!!!! SOS! 关于C#的问题?
using System.Text;
using System.Runtime.InteropServices;namespace Music
{
/**//// <summary>
///
/// </summary>
public class Audio
{
[DllImport("winmm.dll")]
private static extern int mciSendString
(
string lpstrCommand,
string lpstrReturnString,
int uReturnLength,
int hwndCallback
); [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern int GetShortPathName
(
[MarshalAs(UnmanagedType.LPTStr)] string path,
[MarshalAs(UnmanagedType.LPTStr)] StringBuilder shortPath,
int shortPathLength
); public Audio()
{ } public void Play(string FileName)
{
StringBuilder shortPathTemp = new StringBuilder(255);
int result = GetShortPathName(FileName, shortPathTemp, shortPathTemp.Capacity);
string ShortPath = shortPathTemp.ToString(); mciSendString("open "+ShortPath+" alias song","",0,0);
mciSendString("play song","",0,0);
} public void Stop()
{
mciSendString("stop song","",0,0);
} public void Pause()
{
mciSendString("pause song","",0,0);
} public void Close()
{
mciSendString("close song","",0,0);
}
}
}