Need to call
MMRESULT waveInGetErrorText(
MMRESULT mmrError,
LPTSTR pszText,
UINT cchText
);
From C# code. Didn't find the declaration at PINVOKE.net. The description of the func is here
MMRESULT is just an uint value. 0 - no error.. any other value up to 20 - are errors.
Tried lot of patterns. Always get back an empty string.
[DllImport("Winmm", EntryPoint = "waveInGetErrorText")]
public static extern uint waveInGetErrorText(uint mmrError, IntPtr pszText, uint cchText);
When call.
uint r = 12 // for example return value is 12
uint szErrorMessage = 128;
string errorMessage = new string(' ', (int) szErrorMessage);
IntPtr strPtr = Marshal.StringToBSTR(errorMessage);
r = waveInGetErrorText(r, strPtr, szErrorMessage);
The return string is always empty reserved 128 bytes of spaces.
Tried ref
and out
without success..
Pls, any idea why?