0

How to P/Invoke WaveOut API on Windows CE 6.0 R3 ?

When I put this

[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);

It works on Window XP, 7 but throws a message "Can't P/Invoke winmm.dll" on Wnidows CE 6.0.

What am I doing wrong? Is the WaveOut API moved to some other dll or is it something else ?

Anyway SoundPlayer (from .NET Compact Framework 3.5) works correctly.

Patrik
  • 1,286
  • 1
  • 31
  • 64
  • [Coredll](http://msdn.microsoft.com/en-us/library/aa910393.aspx) module? – GSerg Jan 12 '13 at 15:50
  • Yes. Coredll.dll works but had to put out some other functions that are not even in Coredll.dll. Anyway Yes. Coredll.dll is the solution. – Patrik Jan 12 '13 at 16:02

1 Answers1

0

Change winmm.dll to coredll.dll and you are done !

Patrik
  • 1,286
  • 1
  • 31
  • 64