By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,321 Members | 1,909 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,321 IT Pros & Developers. It's quick & easy.

How to play a MIDI file in C# ?

P: n/a
I wrote following code:

using System.Runtime.InteropServices;
public static extern int mciSendString(string lpstrCommand, string
lpstrReturnString,int uReturnLength,
int dwCallback);
public static extern int mciGetErrorString(int errCode,string errMsg,uint

private void btnPlay_Click(object sender, System.EventArgs e)
int r1,r2;
string s1,s2;
string Playingfile;

r1=mciSendString("OPEN "+Playingfile+" TYPE Sequencer wait","",0,0);
r2=mciSendString("PLAY "+Playingfile,"",0,0);
MessageBox.Show("s1="+s1 +" s2="+s2+" r1="+r1.ToString()+"

The MessageBox shows s1 s2 are empty string, while r1=0 and r2=337.
I don't know what the return value 337 mean.
I just want to play a MIDI file in C#. any better way?
Waiting for reply. Thanks.
Nov 15 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.