资源简介
C#调用API实现录音功能,运行后会在C盘下有个mchinese文件夹,里面有个rec.文件。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace record
{
class playwav
{
public static void Play(string strFileName)
{
//调用PlaySound方法播放音乐
Helpers.PlaySound(strFileName IntPtr.Zero Helpers.PlaySoundFlags.SND_ASYNC);
}
}
///
/// 用于播放音乐
///
internal class Helpers
{
[Flags]
public enum PlaySoundFlags : int
{
SND_SYNC = 0x0000 /* play synchronously (default) */ //同步
SND_ASYNC = 0x0001 /* play asynchronously */ //异步
SND_NODEFAULT = 0x0002 /* silence (!default) if sound not found */
SND_MEMORY = 0x0004 /* pszSound points to a memory file */
SND_LOOP = 0x0008 /* loop the sound until next sndPlaySound */
SND_NOSTOP = 0x0010 /* don‘t stop any currently playing sound */
SND_NOWAIT = 0x00002000 /* don‘t wait if the driver is busy */
SND_ALIAS = 0x00010000 /* name is a registry alias */
SND_ALIAS_ID = 0x00110000 /* alias is a predefined ID */
SND_FILENAME = 0x00020000 /* name is file name */
SND_RESOURCE = 0x00040004 /* name is resource name or atom */
}
[DllImport(“winmm.dll“)]
public static extern bool PlaySound(string szSound IntPtr hMod PlaySoundFlags flags);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 40 2008-04-10 13:07 record\record\bangzhu.txt
文件 214 2008-03-17 10:39 record\record\mda.reg
文件 53248 2005-03-18 16:23 record\record\record\record\bin\Debug\Microsoft.DirectX.AudioVideoPlayback.dll
文件 33914 2006-03-07 22:46 record\record\record\record\bin\Debug\Microsoft.DirectX.AudioVideoPlayback.xm
文件 178176 2005-03-18 16:23 record\record\record\record\bin\Debug\Microsoft.DirectX.DirectSound.dll
文件 348085 2006-03-07 22:46 record\record\record\record\bin\Debug\Microsoft.DirectX.DirectSound.xm
文件 223232 2005-03-18 16:23 record\record\record\record\bin\Debug\Microsoft.DirectX.dll
文件 265390 2006-03-07 22:46 record\record\record\record\bin\Debug\Microsoft.DirectX.xm
文件 0 2010-05-29 10:14 record\record\record\record\bin\Debug\rec.wav
文件 32768 2010-05-29 10:10 record\record\record\record\bin\Debug\record.dll
文件 44544 2010-05-29 10:10 record\record\record\record\bin\Debug\record.pdb
文件 24044 2008-03-13 16:00 record\record\record\record\bin\mchinese\rec.wav
文件 1010 2010-05-22 15:34 record\record\record\record\obj\Debug\record.csproj.GenerateResource.Cache
文件 32768 2010-05-29 10:10 record\record\record\record\obj\Debug\record.dll
文件 44544 2010-05-29 10:10 record\record\record\record\obj\Debug\record.pdb
文件 4593 2010-05-22 15:34 record\record\record\record\obj\Debug\record.Properties.Resources.resources
文件 180 2010-05-22 15:34 record\record\record\record\obj\Debug\record.record.resources
文件 12984 2010-05-22 15:35 record\record\record\record\obj\Debug\ResolveAssemblyReference.cache
文件 4608 2008-03-12 12:05 record\record\record\record\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 418 2008-04-08 07:44 record\record\record\record\obj\record.csproj.FileList.txt
文件 1796 2010-05-29 10:14 record\record\record\record\obj\record.csproj.FileListAbsolute.txt
文件 1692 2008-03-14 09:42 record\record\record\record\playwav.cs
文件 1329 2008-03-12 09:01 record\record\record\record\Properties\AssemblyInfo.cs
文件 3840 2008-03-12 12:05 record\record\record\record\Properties\Resources.Designer.cs
文件 6927 2008-03-12 12:05 record\record\record\record\Properties\Resources.resx
文件 4324 2010-05-22 15:31 record\record\record\record\record.csproj
文件 168 2008-03-12 09:17 record\record\record\record\record.csproj.user
文件 879 2008-03-12 09:02 record\record\record\record\Resources\play.jpg
文件 907 2008-03-12 09:02 record\record\record\record\Resources\rec.jpg
文件 920 2008-03-12 09:02 record\record\record\record\Resources\stop.jpg
............此处省略25个文件信息
- 上一篇:C#中的画线控件,可以像按钮一样使用
- 下一篇:wpf led 时钟
评论
共有 条评论