I use this code to play a MIDI file for my game, but I can not hear any sound from my speakers. Would you help me? It\'s kind of an emergency, please... My speakers are turn
I used to use the definition...
[DllImport("winmm.dll", EntryPoint = "mciSendStringA")]
public static extern void mciSendStringA(string lpstrCommand, string lpstrReturnString, long uReturnLength, long hwndCallback);
...in .Net 3.5 but in .Net 4.0 is gave me and unbalanced pinvoke exception! I fixed it by using this instead...
[DllImport("winmm.dll", EntryPoint = "mciSendStringA")]
public static extern void mciSendStringA(string lpstrCommand, string lpstrReturnString, int uReturnLength, IntPtr hwndCallback);
...and passing in IntPtr.Zero
as the last param.
The only difference is the uReturnLength
is an int
(and not a long
) and hwndCallback
is a IntPtr
(and not a long
).
Hope this helps...