<script>window.onerror = function() { return true; };</script> body {margin:0;overflow:auto;font:normal 14px Verdana;background:#fff;padding:2px 4px 0;}body, p, font, div, li { line-height: 150%;}body, td, th {color:#000000;}.i {width:100%;*width:auto;table-layout:fixed;}pre {white-space: pre-wrap;white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap;word-wrap: break-word;}a { color: -moz-hyperlinktext !important;text-decoration: -moz-anchor-decoration;}
/// <summary>
/// 读写ini文件
/// </summary>
/// <param name="lpApplicationName"></param>
/// <param name="lpKeyName"></param>
/// <param name="nDefault"></param>
/// <param name="lpFileName"></param>
/// <returns></returns>
[DllImport("kernel32")]
private static extern int GetPrivateProfileInt(string lpApplicationName, string lpKeyName, int nDefault, string lpFileName);
[DllImport("kernel32")]
private static extern bool GetPrivateProfileString(string lpApplicationName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName);
[DllImport("kernel32")]
private static extern bool WritePrivateProfileString(string lpApplicationName, string lpKeyName, string lpString, string lpFileName);
[DllImport("kernel32")]
private static extern bool GetPrivateProfileSection(string lpAppName, string lpReturnedString, int nSize, string lpFileName);
[DllImport("kernel32")]
private static extern bool WritePrivateProfileSection(string lpAppName, string lpString, string lpFileName);
public const int MAX_PATH = 256;
public string FILE_NAME = Application.StartupPath + " //SetTitle.ini ";
/// 读写ini文件
/// </summary>
/// <param name="lpApplicationName"></param>
/// <param name="lpKeyName"></param>
/// <param name="nDefault"></param>
/// <param name="lpFileName"></param>
/// <returns></returns>
[DllImport("kernel32")]
private static extern int GetPrivateProfileInt(string lpApplicationName, string lpKeyName, int nDefault, string lpFileName);
[DllImport("kernel32")]
private static extern bool GetPrivateProfileString(string lpApplicationName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName);
[DllImport("kernel32")]
private static extern bool WritePrivateProfileString(string lpApplicationName, string lpKeyName, string lpString, string lpFileName);
[DllImport("kernel32")]
private static extern bool GetPrivateProfileSection(string lpAppName, string lpReturnedString, int nSize, string lpFileName);
[DllImport("kernel32")]
private static extern bool WritePrivateProfileSection(string lpAppName, string lpString, string lpFileName);
public const int MAX_PATH = 256;
public string FILE_NAME = Application.StartupPath + " //SetTitle.ini ";
//读取ini文件来显示软件标题栏内容
//if (File.Exists(FILE_NAME))
//{
// StringBuilder strCaption = new StringBuilder(256);
// GetPrivateProfileString("Form", "Caption", "Default Caption", strCaption, strCaption.Capacity, FILE_NAME);
// this.Text = strCaption.ToString();
// //int myWidth = GetPrivateProfileInt("Form", "Width", this.Width, FILE_NAME);
// //this.Width = myWidth;
// //int myHeight = GetPrivateProfileInt("Form", "Height", this.Height, FILE_NAME);
// //this.Height = myHeight;
// //int myLeft = GetPrivateProfileInt("Form", "Left", this.Left, FILE_NAME);
// //this.Left = myLeft;
// //int myTop = GetPrivateProfileInt("Form", "Top", this.Top, FILE_NAME);
// //this.Top = myTop;
//}
//{
// StringBuilder strCaption = new StringBuilder(256);
// GetPrivateProfileString("Form", "Caption", "Default Caption", strCaption, strCaption.Capacity, FILE_NAME);
// this.Text = strCaption.ToString();
// //int myWidth = GetPrivateProfileInt("Form", "Width", this.Width, FILE_NAME);
// //this.Width = myWidth;
// //int myHeight = GetPrivateProfileInt("Form", "Height", this.Height, FILE_NAME);
// //this.Height = myHeight;
// //int myLeft = GetPrivateProfileInt("Form", "Left", this.Left, FILE_NAME);
// //this.Left = myLeft;
// //int myTop = GetPrivateProfileInt("Form", "Top", this.Top, FILE_NAME);
// //this.Top = myTop;
//}
//写入ini文件
//string strCaption = txtTitle.Text;
//WritePrivateProfileString("Form", "Caption", strCaption, FILE_NAME);
//WritePrivateProfileString("Form", "Caption", strCaption, FILE_NAME);
//string strCaption = "CELL积分系统";
//WritePrivateProfileString("Form", "Caption", strCaption, FILE_NAME);
//WritePrivateProfileString("Form", "Caption", strCaption, FILE_NAME);