0

如何在 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)工作正常。

4

1 回答 1

0

将 winmm.dll 更改为 coredll.dll 就完成了!

于 2013-01-12T16:03:16.230 回答