0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| | [DllImport("winmm.dll",CharSet=CharSet.Auto,CallingConvention=CallingConvention.Winapi)]
public static extern int mciSendString(
string lpszCommand, string lpszReturnString, int cchReturn, IntPtr hwndCallback );
private static int MM_MCINOTIFY=0x3B9;
private static int MCI_NOTIFY_SUCCESSFUL = 1;
mciSendString("open "+filename+" alias _snd",null,0,IntPtr.Zero);
mciSendString("play _snd from 0 notify",null,0,this.Handle);
protected override void WndProc(ref Message m) {
if(m.Msg==MM_MCINOTIFY && (int)m.WParam==MCI_NOTIFY_SUCCESSFUL){
mciSendString("stop _snd",null,0,IntPtr.Zero);
mciSendString("close _snd",null,0,IntPtr.Zero);
}
base.WndProc (ref m);
}
|