[DllImport("winmm.dll")]又是什么意思?
[DllImport("winmm.dll")] 
   public static extern long PlaySound(string lpszName, int hModule, int dwFlags);
我把它放在我的程序里出错。说找不到类型或命名窨DllImport

解决方案 »

  1.   

    [DllImport("winmm.dll")]调用WIN32的和多媒体有关的API函数
      

  2.   

    说明你没有引入winmm.dll这个动态链接库。
      

  3.   

    出错是找不到DllImport这个属性所对应的类DllImportAttribute,检查using。。
      

  4.   

    The STAThread attribute basically tells the runtime to set the apartment
    model for thread that the application is first run on. It allows the
    threading model to be set before any initialization code is called (which
    might happen before your code is reached by the runtime).It's needed for some of the windows controls, as they are wrappers to
    COM components which require the COM environment to be set up properly.
      

  5.   

    To tanshiyang82(博深) :[DllImport("winmm.dll")]又是什么意思?
    [DllImport("winmm.dll")] 
       public static extern long PlaySound(string lpszName, int hModule, int dwFlags);
    我把它放在我的程序里出错。说找不到类型或命名窨DllImport这是因为你没有加这句:
    using System.Runtime.InteropServices;