打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

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

 

[csharp] view plain copy
  1. //发送一个游戏杆消息到指定的窗口  
  2. [DllImport("winmm.dll")]  
  3. public static extern int joySetCapture(IntPtr hWnd, int uJoyID, 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 JOYINFOEX pji);   
  12.   
  13.     //检取描述指定媒介控制接口错误代码的字符串  
  14. [DllImport("winmm.dll")]  
  15.  public  static extern Int32 mciGetErrorString(Int32 errorCode, StringBuilder errorText, Int32 errorTextSize);  
  16.   
  17. //向指定的媒介控制接口设备发送一个字符串  
  18. [DllImport("winmm.dll")]  
  19. public static extern Int32 mciSendString(string command,string  buffer, int bufferSize, IntPtr hwndCallback);  
  20.   
  21. //将指定的MIDI输入设备连接到输出设备  
  22. [DllImport("winmm.dll")]  
  23. public static extern UInt32 midiConnect(IntPtr hMidi, IntPtr hmo, IntPtr pReserved);  
  24.   
  25. //断开MIDI输入设备和输出设备的连接  
  26. [DllImport("winmm.dll")]  
  27. public static extern UInt32 midiDisconnect(IntPtr hMidi, 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(UIntPtr 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(UIntPtr uDeviceID, ref MIDIOUTCAPS lpMidiOutCaps, uint cbMidiOutCaps);  
  62.   
  63. //检取有关MIDI输出设备指定采取的文本说明  
  64. [DllImport("winmm.dll")]  
  65. public static extern uint midiOutGetErrorText(uint mmrError, StringBuilder pszText, uint cchText);  
  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 lphMidiOut, uint uDeviceID, IntPtr dwCallback, IntPtr dwInstance, uint dwFlags);  
  74.   
  75. //向指定的MIDI输出设备发送一条短MIDI消息  
  76. [DllImport("winmm.dll")]  
  77. public static extern uint midiOutShortMsg(IntPtr hMidiOut, uint dwMsg);  
  78.   
  79. //关闭一个打开的MIDI流  
  80. [DllImport("winmm.dll")]  
  81. public extern static Int32 midiStreamClose(IntPtr hMidiStream);  
  82.   
  83.   
  84. //为输出,打开一个MIDI流  
  85. [DllImport("winmm.dll")]  
  86. public extern static Int32 midiStreamOpen(ref IntPtr hMidiStream, 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 hMidiStream);  
  91.   
  92.   
  93. //关掉指定MIDI输出设备的所有MIDI通道  
  94. [DllImport("winmm.dll")]  
  95. public static extern Int32 midiStreamStop(IntPtr hMidiStream);  
  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(IntPtr hmxobj, ref MIXERCONTROLDETAILS pmxcd, UInt32 fdwDetailsmixer);  
  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 hmxobj, 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, uint 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, IntPtr hmod, SoundFlags fdwSound);  
  140.   
  141.   
  142. //设置应用程序或驱动程序使用的最小定时器分辨率  
  143. [DllImport("winmm.dll", SetLastError = true)]  
  144. public static extern uint timeBeginPeriod(uint uMilliseconds);  
  145.   
  146. //清除应用程序或驱动程序使用的最小定时器分辨率  
  147. [DllImport("winmm.dll", SetLastError = true)]  
  148. public static extern uint timeEndPeriod(uint uMilliseconds);  
  149.   
  150. //查询定时器设备以确定其性能  
  151. [DllImport("winmm.dll", SetLastError = true)]  
  152. public static extern UInt32 timeGetDevCaps(ref TimeCaps timeCaps,UInt32 sizeTimeCaps);  
  153.   
  154. //检取从WINDOWS开始已逝去的毫秒数  
  155. [DllImport("winmm.dll", SetLastError = true)]  
  156. public static extern UInt32 timeGetSystemTime(ref MmTime 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 timerEventId);  
  165.   
  166. //设置一个定时器回调事件  
  167. [DllImport("winmm.dll", SetLastError = true)]  
  168. public static extern UInt32 timeSetEvent(UInt32 msDelay, 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 hWaveIn, uint deviceId, ref WaveFormate wfx, IntPtr dwCallBack, uint dwInstance, 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,ref 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 waveInUnprepareHeader(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 hwo, 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 mmrError, StringBuilder pszText, uint cchText);  
  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(IntPtr hwo, uint dwRate);  
  230.   
  231. // 查询指定波形输出设备的当前音量设置  
  232. [DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]  
  233.  public static extern uint waveOutGetVolume(IntPtr hwo, uint dwVolume);  
  234.   
  235. //为播放打开一个波形输出设备  
  236. [DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]  
  237. public static extern uint waveOutOpen(ref IntPtr hWaveOut, IntPtr uDeviceID, ref WaveFormate lpFormat, IntPtr dwCallback, 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(IntPtr hwo, uint dwRate);  
  256.   
  257. //设置指定的波形输出设备的音量  
  258. [DllImport("winmm.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]  
  259. public static extern int waveOutSetVolume(int uDeviceID, int dwVolume);  
  260.   
  261. //清除由waveOutPrepareHeader函数实现的准备  
  262. [DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]  
  263. public static extern uint waveOutUnprepareHeader(IntPtr 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);  

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
c#类,封装了键盘,和鼠标模拟,和内存读取(申精)(页 1) - 网络安全 - ZDNet...
C#获取进程的主窗口句柄
驱动程序安装类(C#)
C# 实现对硬件的控制
共享内存操作类(C#源码)
Winio64在64位系统中初始化失败问题
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服