using
System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace Config
... {
class PrivateProfile
...{
/**//// <summary>
/// 添加GetPrivateProfileInt等API函数的声明
/// </summary>
//UINT GetPrivateProfileInt(
// LPCTSTR lpAppName,
// LPCTSTR lpKeyName,
// INT nDefault,
// LPCTSTR lpFileName
//);
[DllImport("kernel32", EntryPoint = "GetPrivateProfileInt")]
public static extern int GetInt(
string lpAppName,
string lpKeyName,
int nDefault,
string lpFileName);
//DWORD GetPrivateProfileSection(
// LPCTSTR lpAppName,
// LPTSTR lpReturnedString,
// DWORD nSize,
// LPCTSTR lpFileName
//);
[DllImport("kernel32", EntryPoint = "GetPrivateProfileSection")]
public static extern int GetSection(
string lpAppName,
StringBuilder lpReturnedString,
int nSize,
string lpFileName);
//DWORD GetPrivateProfileSectionNames(
// LPTSTR lpszReturnBuffer,
// DWORD nSize,
// LPCTSTR lpFileName
//);
[DllImport("kernel32", EntryPoint = "GetPrivateProfileSectionNames")]
public static extern int GetSectionNames(
StringBuilder lpszReturnBuffer,
int nSize,
string lpFileName);
//DWORD GetPrivateProfileString(
// LPCTSTR lpAppName,
// LPCTSTR lpKeyName,
// LPCTSTR lpDefault,
// LPTSTR lpReturnedString,
// DWORD nSize,
// LPCTSTR lpFileName
//);
[DllImport("kernel32", EntryPoint = "GetPrivateProfileString")]
public static extern int GetString(
string lpAppName,
string lpKeyName,
string lpDefault,
StringBuilder lpReturnedString,
int nSize,
string lpFileName);
//BOOL GetPrivateProfileStruct(
// LPCTSTR lpszSection,
// LPCTSTR lpszKey,
// LPVOID lpStruct,
// UINT uSizeStruct,
// LPCTSTR szFile
//);
[DllImport("kernel32", EntryPoint = "GetPrivateProfileStruct")]
unsafe public static extern bool GetStruct(
string lpszSection,
string lpszKey,
void* lpStruct,
uint uSizeStruct,
string szFile
);
//BOOL WritePrivateProfileSection(
// LPCTSTR lpAppName,
// LPCTSTR lpString,
// LPCTSTR lpFileName
//);
[DllImport("kernel32",EntryPoint = "WritePrivateProfileSection" )]
public static extern bool WriteSection(
string lpAppName,
string lpString,
string lpFileName);
// BOOL WritePrivateProfileString(
// LPCTSTR lpAppName,
// LPCTSTR lpKeyName,
// LPCTSTR lpString,
// LPCTSTR lpFileName
//);
[DllImport("kernel32", EntryPoint = "WritePrivateProfileString")]
public static extern bool WriteString(
string lpAppName,
string lpKeyName,
string lpString,
string lpFileName);
//BOOL WritePrivateProfileStruct(
// LPCTSTR lpszSection,
// LPCTSTR lpszKey,
// LPVOID lpStruct,
// UINT uSizeStruct,
// LPCTSTR szFile
//);
[DllImport("kernel32", EntryPoint = "WritePrivateProfileStruct")]
unsafe public static extern bool WriteStruct(
string lpszSection,
string lpszKey,
void* lpStruct,
uint uSizeStruct,
string szFile);
}
}
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace Config
... {
class PrivateProfile
...{
/**//// <summary>
/// 添加GetPrivateProfileInt等API函数的声明
/// </summary>
//UINT GetPrivateProfileInt(
// LPCTSTR lpAppName,
// LPCTSTR lpKeyName,
// INT nDefault,
// LPCTSTR lpFileName
//);
[DllImport("kernel32", EntryPoint = "GetPrivateProfileInt")]
public static extern int GetInt(
string lpAppName,
string lpKeyName,
int nDefault,
string lpFileName);
//DWORD GetPrivateProfileSection(
// LPCTSTR lpAppName,
// LPTSTR lpReturnedString,
// DWORD nSize,
// LPCTSTR lpFileName
//);
[DllImport("kernel32", EntryPoint = "GetPrivateProfileSection")]
public static extern int GetSection(
string lpAppName,
StringBuilder lpReturnedString,
int nSize,
string lpFileName);
//DWORD GetPrivateProfileSectionNames(
// LPTSTR lpszReturnBuffer,
// DWORD nSize,
// LPCTSTR lpFileName
//);
[DllImport("kernel32", EntryPoint = "GetPrivateProfileSectionNames")]
public static extern int GetSectionNames(
StringBuilder lpszReturnBuffer,
int nSize,
string lpFileName);
//DWORD GetPrivateProfileString(
// LPCTSTR lpAppName,
// LPCTSTR lpKeyName,
// LPCTSTR lpDefault,
// LPTSTR lpReturnedString,
// DWORD nSize,
// LPCTSTR lpFileName
//);
[DllImport("kernel32", EntryPoint = "GetPrivateProfileString")]
public static extern int GetString(
string lpAppName,
string lpKeyName,
string lpDefault,
StringBuilder lpReturnedString,
int nSize,
string lpFileName);
//BOOL GetPrivateProfileStruct(
// LPCTSTR lpszSection,
// LPCTSTR lpszKey,
// LPVOID lpStruct,
// UINT uSizeStruct,
// LPCTSTR szFile
//);
[DllImport("kernel32", EntryPoint = "GetPrivateProfileStruct")]
unsafe public static extern bool GetStruct(
string lpszSection,
string lpszKey,
void* lpStruct,
uint uSizeStruct,
string szFile
);
//BOOL WritePrivateProfileSection(
// LPCTSTR lpAppName,
// LPCTSTR lpString,
// LPCTSTR lpFileName
//);
[DllImport("kernel32",EntryPoint = "WritePrivateProfileSection" )]
public static extern bool WriteSection(
string lpAppName,
string lpString,
string lpFileName);
// BOOL WritePrivateProfileString(
// LPCTSTR lpAppName,
// LPCTSTR lpKeyName,
// LPCTSTR lpString,
// LPCTSTR lpFileName
//);
[DllImport("kernel32", EntryPoint = "WritePrivateProfileString")]
public static extern bool WriteString(
string lpAppName,
string lpKeyName,
string lpString,
string lpFileName);
//BOOL WritePrivateProfileStruct(
// LPCTSTR lpszSection,
// LPCTSTR lpszKey,
// LPVOID lpStruct,
// UINT uSizeStruct,
// LPCTSTR szFile
//);
[DllImport("kernel32", EntryPoint = "WritePrivateProfileStruct")]
unsafe public static extern bool WriteStruct(
string lpszSection,
string lpszKey,
void* lpStruct,
uint uSizeStruct,
string szFile);
}
}