[Dllimport ......]
就可以了

解决方案 »

  1.   

    using System.Runtime.InteropServices;
    [DllImport.....]
    private  static extern Type GetPrivateProfileString(...)
      

  2.   

    [DllImport("kernel32")]
            private static extern int GetPrivateProfileString(string section,
                     string key,string def, StringBuilder retVal,
                int size,string filePath);
    http://www.codeproject.com/csharp/cs_ini.asp
      

  3.   

    [ DllImport ( "kernel32" ) ]
    private static extern long WritePrivateProfileString ( string section ,string key ,string val,  string filePath) ;

    [ DllImport ("kernel32")]
    private static extern int GetPrivateProfileString ( string section ,string key , string def , StringBuilder retVal ,int size , string filePath ) ;WritePrivateProfileString ( section , key , keyValue , FileName ) ;int i = GetPrivateProfileString ( section ,key ,"无法读取对应数值!",temp , 255 , FileName ) ;