C# 调用声音文件,包括API函数和调用VisualBasic(vs2003)函数
2007-03-29 20:30
330 查看
<一>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;
PlaySound("提示时奏幻想空间.WAV",0,SND_ASYNC|SND_FILENAME);
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;
PlaySound("提示时奏幻想空间.WAV",0,SND_ASYNC|SND_FILENAME);
相关文章推荐
- javascript与cs代码互相调用 asp.net中前台javascript与后台C#交互 这里主要包括了javascipt与后台CS代码四种方法互调(其中包括函数与变量的访问)
- c#.net前台调用JS文件中的函数[.net与JavaScript的应用]
- C#中调用C++的dll的参数为指针类型的导出函数(包括二级指针的情况)
- asp.net中调用javascript自定义函数的方法(包括引入JavaScript文件)总结
- C#调用声音函数(PlaySound,Beep,MessageBeep等)
- C#中调用C++的dll的参数为指针类型的导出函数(包括二级指针的情况)
- C#中调用C++的dll的参数为指针类型的导出函数(包括二级指针的情况)
- [转]高手看过来:winform里用C#怎么播放音频文件(例如:*.wav)?C#中怎样调用api函数和com组件?
- asp.net中调用javascript自定义函数的方法(包括引入JavaScript文件)总结
- asp.net中调用javascript自定义函数的方法(包括引入JavaScript文件)总结
- C#调用参数为函数指针的API函数 - 以SetUnhandledExceptionFilter为例编写一个全局异常处理程序
- C#中调用C++的dll的参数为指针类型的导出函数(包括二级指针的情况)
- C#调用matlab函数详细步骤和例程
- 通过调用同一个函数(参数不同)将数据写入文件和显示到屏幕上
- 调用Windows API函数播放声音
- C++调用C#dll提示源文件未找到
- c#调用oracle存储过程返回结果集及函数
- C#系列之在C#中调用EXE文件
- VC中使用低级音频函数WaveX播放声音文件