using System.Runtime.InteropServices;[DllImport("your.dll")]
static extern /* your function signature here */;

解决方案 »

  1.   

    给你个播放声音的类,参考一下
    public class sndPlay 
    {
    //声音动态连接库声明
    [DllImport("winmm.dll", EntryPoint="PlaySound")]
    public static extern bool PlaySound(ref Byte snd, IntPtr hmod, uint fdwSound);

    [DllImport("winmm.dll", EntryPoint="PlaySound")]
    public static extern int PlaySound(string  lpszName,int hModule,int dwFlags); public enum PlayingFlags :uint 
    {
    SND_SYNC = 0x00,
    SND_ASYNC = 0x01,
    SND_NODEFAULT = 0x02,
    SND_MEMORY = 0x04,
    SND_ALIAS = 0x010000,
    SND_FILENAME = 0x020000,
    SND_RESOURCE = 0x040004,
    SND_ALIAS_ID = 0x0110000,
    SND_ALIAS_START = 0,
    SND_LOOP = 0x08,
    SND_NOSTOP = 0x010,
    SND_VALID = 0x01F,
    SND_NOWAIT = 0x02000,
    SND_PURGE = 0x40
    }
    }