winmm.dll函数详细引用方法(C#)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

winmm.dll函数详细引用方法(C#)
[csharp] view plain copy
1.//发送一个游戏杆消息到指定的窗口
2.[DllImport("winmm.dll")]
3.public static extern int joySetCapture(IntPtr hWnd, int uJo yID, int uPeriod, bool fChanged);
4.
5.//查询指定的游戏杆设备的位置和活动性
6.[DllImport("winmm.dll")]
7.public static extern int joyGetPos(int uJoyID, ref JOYINFO pji);
8.
9.//查询一个游戏杆设备的位置和它的按扭状态
10.[DllImport("winmm.dll")]
11.public static extern int joyGetPosEx(int uJoyID, ref JOYI NFOEX pji);
12.
13.//检取描述指定媒介控制接口错误代码的字符串
14.[DllImport("winmm.dll")]
15.public static extern Int32 mciGetErrorString(Int32 erro rCode, StringBuilder errorText, Int32 errorTextSize);
16.
17.//向指定的媒介控制接口设备发送一个字符串
18.[DllImport("winmm.dll")]
19.public static extern Int32 mciSendString(string comma nd,string buffer, int bufferSize, IntPtr hwndCallback);
20.
21.//将指定的MIDI输入设备连接到输出设备
22.[DllImport("winmm.dll")]
23.public static extern UInt32 midiConnect(IntPtr hMidi, I ntPtr hmo, IntPtr pReserved);
24.
25.//断开MIDI输入设备和输出设备的连接
26.[DllImport("winmm.dll")]
27.public static extern UInt32 midiDisconnect(IntPtr hMid i, IntPtr hmo, IntPtr pReserved);
28.
29.//关闭指定的音乐仪器数字接口的输入设备
30.[DllImport("winmm.dll", SetLastError = true)]
31.public static extern uint midiInClose(IntPtr hMidiIn);
32.
33.//查询指定的音乐仪器数字接口的输入设备,以确定其性能
34.[DllImport("winmm.dll", SetLastError = true)]
35.public static extern MMRESULT midiInGetDevCaps(UIn tPtr uDeviceID, ref MIDIINCAPS caps, uint cbMidiInCaps);
36.
37.//查询指定的音乐仪器数字接口的输入设备,以确定其性能
38.[DllImport("winmm.dll", SetLastError = true)]
39.public static extern uint midiInGetNumDevs();
40.
41.//打开指定的音乐仪器数字接口的输入设备
42.[DllImport("winmm.dll", SetLastError=true)]
43.public static extern uint midiInOpen(IntPtr hMidiIn);
44.
45.
46.//在给定的MIDI输入设备上输入,并将所有挂起的输入缓
冲区标记为已执行的
47.[DllImport("winmm.dll", SetLastError = true)]
48.public static extern uint midiInReset(IntPtr hMidiIn);
49.
50.//启动在指定的音乐仪器数字接口的输入设备上的输入
51.[DllImport("winmm.dll", SetLastError = true)]
52.public static extern uint midiInStart(IntPtr hMidiIn);
53.
54.
55.//关闭指定的音乐仪器数字接口的输出设备
56.[DllImport("winmm.dll")]
57.public static extern uint midiOutClose(IntPtr hMidiOut );
58.
59.//查询指定的音乐仪器数字接口的输出设备,以确定其性能
60.[DllImport("winmm.dll", SetLastError = true)]
61.public static extern MMRESULT midiOutGetDevCaps(U IntPtr uDeviceID, ref MIDIOUTCAPS lpMidiOutCaps, uint cbMidi OutCaps);
62.
63.//检取有关MIDI输出设备指定采取的文本说明
64.[DllImport("winmm.dll")]
65.public static extern uint midiOutGetErrorText(uint mmr Error, StringBuilder pszText, uint cchT ext);
66.
67.//检取系统中存在的MIDI输出设备的数量
68.[DllImport("winmm.dll", SetLastError = true)]
69.public static extern uint midiOutGetNumDevs();
70.
71.//打开指定的MIDI输出设备进行回放
72.[DllImport("winmm.dll")]
73.public static extern uint midiOutOpen(out IntPtr lphMi diOut, uint uDeviceID, IntPtr dwCallback, IntPtr dwInstance, uint dwFlags);
74.
75.//向指定的MIDI输出设备发送一条短MIDI消息
76.[DllImport("winmm.dll")]
77.public static extern uint midiOutShortMsg(IntPtr hMid iOut, uint dwMsg);
78.
79.//关闭一个打开的MIDI流
80.[DllImport("winmm.dll")]
81.public extern static Int32 midiStreamClose(IntPtr hMid iStream);
82.
83.
84.//为输出,打开一个MIDI流
85.[DllImport("winmm.dll")]
86.public extern static Int32 midiStreamOpen(ref IntPtr h MidiStream, ref Int32 puDeviceID, Int32 cMidi, IntPtr dwCallback , IntPtr dwInstance, Int32 fdwOpen);
87.
88.//暂停一个MIDI流的播放
89.[DllImport("winmm.dll")]
90.public static extern Int32 midiStreamPause(IntPtr hMi diStream);
91.
92.
93.//关掉指定MIDI输出设备的所有MIDI通道
94.[DllImport("winmm.dll")]
95.public static extern Int32 midiStreamStop(IntPtr hMidi Stream);
96.
97.//关闭指定的混频器
98.[DllImport("winmm.dll")]
99.public static extern Int32 mixerClose(IntPtr hmx);
100.
101.//检取和一个声频指线路相关的单一控件的细节
102.[DllImport("winmm.dll")]
103.public static extern Int32 mixerGetControlDetails(IntPt r hmxobj, ref MIXERCONTROLDETAILS pmxcd, UInt32 fdwDetail smixer);
104.
105.//查询指定的混频器以确定其性能
106.[DllImport("winmm.dll", SetLastError = true)]
107.public static extern uint MixerGetDevCaps(int mixerId, ref MixerCaps mixerCaps, int mixerCapsSize);
108.
109.
110.//获取指定混频器的标识符
111.[DllImport("winmm.dll", SetLastError=true)]
112.public static extern MMRESULT mixerGetID(int hmxobj , uint puMxId, MixerFlags fdwId);
113.
114.//检取和一个声频线路相关的一个或多个控件
115.[DllImport("winmm.dll")]
116.public static extern Int32 mixerGetLineControls(IntPtr hmxobj, ref MIXERLINECONTROLS pmxlc, UInt32 fdwControls);
117.
118.//检取混频器有关特有线路的信息
119.[DllImport("winmm.dll")]
120.public static extern Int32 mixerGetLineInfo(IntPtr hmx obj, ref MixerLine pmxl, UInt32 fdwInfo);
121.
122.//返回系统中存在的混频器的数量
123.[DllImport("winmm.dll", SetLastError = true)]
124.public static extern uint mixerGetNumDevs();
125.
126.//打开指定的混频器,在应用程序关闭该句柄前保证该设备不被移走
127.[DllImport("winmm.dll")]
128.public static extern Int32 mixerOpen(ref IntPtr phmx, u int pMxId,IntPtr dwCallback, IntPtr dwInstance, UInt32 fdwOpen );
129.
130.//设置和一个声频指线路相关的单一控件的细节
131.[DllImport("winmm.dll")]
132.public static extern Int32 mixerSetControlDetails(IntPtr hmxobj, ref MIXERCONTROLDETAILS pmxcd, UInt32 fdwDetails) ;
133.
134.//播放一个波形声音
135.[DllImport("winmm.dll", SetLastError = true)]
136.public static extern bool PlaySound(string pszSound, UIntPtr hmod, uint fdwSound);
137.
138.[DllImport("winmm.dll", SetLastError = true)]
139.public static extern bool PlaySound(byte[] pszSound, I ntPtr hmod, SoundFlags fdwSound);
140.
141.
142.//设置应用程序或驱动程序使用的最小定时器分辨率
143.[DllImport("winmm.dll", SetLastError = true)]
144.public static extern uint timeBeginPeriod(uint uMillise conds);
145.
146.//清除应用程序或驱动程序使用的最小定时器分辨率
147.[DllImport("winmm.dll", SetLastError = true)]
148.public static extern uint timeEndPeriod(uint uMilliseco nds);
149.
150.//查询定时器设备以确定其性能
151.[DllImport("winmm.dll", SetLastError = true)]
152.public static extern UInt32 timeGetDevCaps(ref TimeC aps timeCaps,UInt32 sizeTimeCaps);
153.
154.//检取从WINDOWS开始已逝去的毫秒数
155.[DllImport("winmm.dll", SetLastError = true)]
156.public static extern UInt32 timeGetSystemTime(ref M mTime mmTime, UInt32 sizeMmTime);
157.
158.//检取从WINDOWS开始已逝去的毫秒数,此函数比上一条函数开销小
159.[DllImport("winmm.dll", SetLastError = true)]
160.public static extern uint timeGetTime();
161.
162.//毁掉指定的定时器回调事件
163.[DllImport("winmm.dll", SetLastError = true)]
164.public static extern UInt32 timeKillEvent(UInt32 timerE
ventId);
165.
166.//设置一个定时器回调事件
167.[DllImport("winmm.dll", SetLastError = true)]
168.public static extern UInt32 timeSetEvent(UInt32 msDel ay, UInt32 msResolution,TimerEventHandler handler, ref UInt32 userCtx, UInt32 eventType);
169.
170.
171.//关闭指定的波形输入设置
172.[DllImport("winmm.dll", SetLastError = true)]
173.static extern uint waveInClose(IntPtr hwi);
174.
175.// 返回系统中存在的波形输入设备的数量
176.[DllImport("winmm.dll", SetLastError = true)]
177.public static extern uint waveInGetNumDevs();
178.
179.//为录音而打开一个波形输入设备
180.[DllImport("winmm.dll")]
181.public static extern uint waveInOpen(ref IntPtr hWaveI n, uint deviceId, ref WaveFormate wfx, IntPtr dwCallBack, uint d wInstance, uint dwFlags);
182.
183.//为波形输入准备一个输入缓冲区
184.[DllImport("winmm.dll", SetLastError = true)]
185.public static extern MMRESULT waveInPrepareHeader( IntPtr hwi, ref WaveHDR pwh, uint cbwh);
186.
187.//停止给定的波形输入设备的输入,且将当前位置清零
188.[DllImport("winmm.dll", SetLastError = true)]
189.public static extern uint waveInReset(IntPtr hwi);
190.
191.// //启动在指定的波形输入设备的输入
192.[DllImport("winmm.dll", SetLastError = true)]
193.public static extern uint waveInStart(IntPtr hwi);
194.
195.[DllImport("winmm.dll", SetLastError = true)]
196.public static extern int waveInAddBuffer(int hWaveIn,r ef WaveHDR lpWaveInHdr,int uSize);
197.
198.
199.
200.// 查询一个指定的波形输入设备以确定其性能
201.[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
202.public static extern uint waveInGetDevCaps(IntPtr hwo , ref WAVEINCAPS pwoc, uint cbwoc);
203.
204.////清除由waveInPrepareHeader函数实现的准备
205.[DllImport("winmm.dll", SetLastError = true)]
206.public static extern MMRESULT waveInUnprepareHead er(IntPtr hwi, ref WaveHDR pwh, uint cbwh);
207.
208.//关闭指定的波形输出设备
209.[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
210.public static extern uint waveOutClose(IntPtr hwo);
211.
212.// 查询一个指定的波形输出设备以确定其性能
213.[DllImport("winmm.dll", SetLastError = true, CharSet =
CharSet.Auto)]
214.public static extern uint waveOutGetDevCaps(IntPtr h wo, ref WAVEOUTCAPS pwoc, uint cbwoc);
215.
216.
217.
218.
219.//检取由指定的错误代码标识的文本说明
220.[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
221.public static extern uint waveOutGetErrorText(uint mm rError, StringBuilder pszText, uint cchT ext);
222.
223.//检取系统中存在的波形输出设备的数量
224.[DllImport("winmm.dll", SetLastError = true)]
225.public static extern uint waveOutGetNumDevs();
226.
227.//查询一个波形输出设备当前播放的速度
228.[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
229.public static extern uint waveOutGetPlaybackRate(IntP tr hwo, uint dwRate);
230.
231.// 查询指定波形输出设备的当前音量设置
232.[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
233.public static extern uint waveOutGetVolume(IntPtr hw o, uint dwVolume);
234.
235.//为播放打开一个波形输出设备
CharSet.Auto)]
237.public static extern uint waveOutOpen(ref IntPtr hWav eOut, IntPtr uDeviceID, ref WaveFormate lpFormat, IntPtr dwCall back, IntPtr dwInstance, uint dwFlags);
238.
239.//暂停指定波形输出设备上的播放
240.[DllImport("winmm.dll")]
241.public static extern uint waveOutPause(IntPtr hwo);
242.
243.
244.//为播放准备一个波形缓冲区
245.[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
246.public static extern uint waveOutPrepareHeader(IntPtr hWaveOut, ref WaveHDR lpWaveOutHdr, int uSize);
247.
248.
249.//停止给定的波形输出设备的输出,且将当前位置清零
250.[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
251.public static extern uint waveOutReset(IntPtr hwo);
252.
253.//设置指定波形输出设备的速度
254.[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
255.public static extern uint waveOutSetPlaybackRate(IntP tr hwo, uint dwRate);
256.
257.//设置指定的波形输出设备的音量
nvention = CallingConvention.Winapi)]
259.public static extern int waveOutSetVolume(int uDevice ID, int dwVolume);
260.
261.//清除由waveOutPrepareHeader函数实现的准备
262.[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
263.public static extern uint waveOutUnprepareHeader(Int Ptr hwo, ref WaveHDR pwh, uint cbwh);
264.
265.//向指定的波形输出设备发送一个数据块
266.[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
267.public static extern uint waveOutWrite(IntPtr hwo, ref WaveHDR pwh, uint cbwh);。

相关文档
最新文档