1.引用名称空间。
using System.Runtime.InteropServices;
2.函数申明。
以接口:
UINT mciSendString(LPCTSTR lpszCommand, LPTSTR lpszReturnString, UINT cchReturn, HANDLE hwndCallback);
c#声明如下:
[DllImport("winmm.dll")]
public static extern int mciSendString(string cmd, string msg, int msgSize, int hwnd);
3.调用。
mciSendString(string.Format("open {0}", fullName)
,null, 0, 0
);