我先编写一个写日志的程序,希望可以在编写日志的时候程序播放出优雅的背景音乐?希望高手指点一下,谢谢!
解决方案 »
- 线程池问题:关于主线程退出,怎样结束子线程的问题
- 当前标识(B205101\ASPNET)没有对“C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files”的写访问权限。
- DataGrid添加CheckBox
- 请问用.net开发web ,要精通javascipt吗
- 事件的问题?
- 请问DataGridView 中如何显示详细的时间
- [不算灌水的灌水]...这年头软件被人做完了。。郁闷 大家在做什么?
- 用 C# 做一个淘宝网的购物车 怎么做!帮忙下
- 连接ORACLE数据库时,出现异常,信息为:unable to load Dll (oci.dll).请问怎么解决?
- 200分想和大家讨论一个问题:为什么有些人会说搞数据库开发只是表面的东西,技术含量不高,真正的程序员要做底层开发。
- 如何修改,多数据库表连接查询出的DataGridView中的数据
- C#里的泛型LinkedList,在VC.net或VC++里可以用什么对应?
using System.IO;SoundPlayer music = new SoundPlayer();music = new SoundPlayer(Directory.GetCurrentDirectory() + "\\歌名.wav");
music.Play();
{
public static void Play( string strFileName, PlaySoundFlags soundFlags)
{
PlaySound( strFileName, IntPtr.Zero, soundFlags);
// passes to Playsound the filename and a pointer
// to the Flag
} [DllImport("winmm.dll")] //inports the winmm.dll used for sound
private static extern bool PlaySound( string szSound, IntPtr hMod, PlaySoundFlags flags );
} [Flags] //enumeration treated as a bit field or set of flags
public enum PlaySoundFlags: int
{ SND_SYNC = 0x0000, /* play synchronously (default) */
SND_ASYNC = 0x0001, /* play asynchronously */
SND_NODEFAULT = 0x0002, /* silence (!default) if sound notfound */
SND_LOOP = 0x0008, /* loop the sound until nextsndPlaySound */
SND_NOSTOP = 0x0010, /* don't stop any currently playingsound */
SND_NOWAIT = 0x00002000, /* don't wait if the driver is busy */
SND_FILENAME = 0x00020000, /* name is file name */
SND_RESOURCE = 0x00040004 /* name is resource name or atom */
}
using System.IO; SoundPlayer music = new SoundPlayer(); music = new SoundPlayer(Directory.GetCurrentDirectory() + "\\歌名.wav");
music.Play();
{
SoundPlayer msc = new SoundPlayer("文件路径");
msc.Play();
}
//文件路径为音乐文件在本地磁盘的路径,后缀名为.wav。
//例如C:\Program Files\Tencent\QQ\Misc\Sound\Classic\Audio.wav