对于传统的动态链接库,使用下面的方式:
using System.Runtime.InteropServices;
[DllImport("kernel32.dll")]
public static extern int Beep(int dwFreq, int dwDuration);
private void WarnSound()
{
Beep(1900, 3000);
}
如果使用基于COM的组件,可以直接引用,.net提供包装功能
using System.Runtime.InteropServices;
[DllImport("kernel32.dll")]
public static extern int Beep(int dwFreq, int dwDuration);
private void WarnSound()
{
Beep(1900, 3000);
}
如果使用基于COM的组件,可以直接引用,.net提供包装功能