【发布时间】:2012-12-27 00:35:51
【问题描述】:
如何在 Windows CE 6.0 R3 上 P/Invoke WaveOut API?
当我放这个
[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern MMRESULT waveOutOpen(ref IntPtr hWaveOut, int uDeviceID, ref WAVEFORMATEX lpFormat, DelegateWaveOutProc dwCallBack, int dwInstance, int dwFlags);
[DllImport("winmm.dll")]
public static extern MMRESULT waveInOpen(ref IntPtr hWaveIn, int deviceId, ref WAVEFORMATEX wfx, DelegateWaveInProc dwCallBack, int dwInstance, int dwFlags);
[DllImport("winmm.dll", SetLastError = true)]
public static extern MMRESULT waveInStart(IntPtr hWaveIn);
[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern uint waveInGetDevCaps(int index, ref WAVEINCAPS pwic, int cbwic);
[DllImport("winmm.dll", SetLastError = true)]
public static extern uint waveInGetNumDevs();
[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern uint waveOutGetDevCaps(int index, ref WAVEOUTCAPS pwoc, int cbwoc);
[DllImport("winmm.dll", SetLastError = true)]
public static extern uint waveOutGetNumDevs();
[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern MMRESULT waveOutWrite(IntPtr hWaveOut, ref WAVEHDR pwh, int cbwh);
[DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern MMRESULT waveOutPrepareHeader(IntPtr hWaveOut, ref WAVEHDR lpWaveOutHdr, int uSize);
它可以在 Window XP, 7 上运行,但在 Wnidows CE 6.0 上会抛出一条消息“Can't P/Invoke winmm.dll”。
我做错了什么? WaveOut API 是移动到其他 dll 还是其他什么?
无论如何,SoundPlayer(来自 .NET Compact Framework 3.5)工作正常。
【问题讨论】:
-
Coredll 模块?
-
是的。 Coredll.dll 可以工作,但不得不推出一些甚至不在 Coredll.dll 中的其他功能。无论如何是的。 Coredll.dll 是解决方案。
标签: audio pinvoke windows-ce waveout waveoutwrite