当前位置:首页 > 网络编程 > 软件语言 > .NET > C#调用声音函数(PlaySound,Beep,MessageBeep等)

C#调用声音函数(PlaySound,Beep,MessageBeep等)

点击次数:75 次 发布日期:2008-11-06 07:52:59 作者:源代码网
源代码网推荐
广告载入中

源代码网整理以下C# 调用声音文件,包括API函数和调用VisualBasic函数

源代码网整理以下 

源代码网整理以下<一>Visual Basic Beep()

源代码网整理以下1.使用Visual Basic Beep函数;添加引用 Miscorsoft Visual Basic Runtime

源代码网整理以下2.调用 Interaction.Beep();

源代码网整理以下<二>使用MessageBeep(unit uType):需添加 using System.Runtime.InteropServices;

源代码网整理以下public const int MB_ICONEXCLAMATION =  48;

源代码网整理以下  [DllImport("user32.dll")]
  public static extern bool MessageBeep(uint uType);

源代码网整理以下MessageBeep( MB_ICONEXCLAMATION );

源代码网整理以下<三>调用Beep(Int freq,int duration)函数

源代码网整理以下  [DllImport("kernel32.dll")]
  public static extern bool Beep(int freq,int duration);

源代码网整理以下Beep(800,300);

源代码网整理以下<四>调用PlaySound(string pszSound,int hmod,int fdwSound)
  [DllImport("winmm.dll")]
  public static extern bool PlaySound(string pszSound,int hmod,int fdwSound);
  public const int SND_FILENAME = 0x00020000;
  public const int SND_ASYNC = 0x0001; 软件开发网 www.mscto.com

源代码网整理以下PlaySound("提示时奏幻想空间.WAV",0,SND_ASYNC|SND_FILENAME);


源代码网推荐

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华