-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathIni.h
42 lines (33 loc) · 850 Bytes
/
Ini.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include "Common.h"
class CIni
{
private:
YCString m_sIniPath;
YCString m_sSection;
YCString m_sKey;
public:
CIni();
CIni(LPCTSTR IniName);
void SetSection(HINSTANCE hInst, UINT uID);
void SetSection(LPCTSTR section) { m_sSection = section; }
void SetKey(LPCTSTR key) { m_sKey = key; }
template <typename _Ty>
void GetDec(_Ty* dec, CONST _Ty def)
{
*dec = GetPrivateProfileInt(m_sSection, m_sKey, def, m_sIniPath);
}
template <typename _Ty>
void GetDec(_Ty* dec)
{
*dec = GetPrivateProfileInt(m_sSection, m_sKey, *dec, m_sIniPath);
}
void GetHex(LPDWORD hex, LPCTSTR def);
void GetStr(LPTSTR str, LPCTSTR def, CONST DWORD len);
void GetStr(YCString& str, YCString def);
void WriteBool(BOOL flag);
void WriteDec(INT dec);
void WriteHex(DWORD hex);
void WriteStr(LPCTSTR str);
BOOL DeleteSection();
};