⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 settings.h

📁 图像处理的压缩算法
💻 H
📖 第 1 页 / 共 2 页
字号:
					int nNumLevels = ini.ReadInt("Config", "NumLevels", 0);
					printf("NumLevels = %d", nNumLevels);
					
	*/
	void	SetFileName(LPCSTR lpcszSection);
	
	/**
				Gets the name of the INI file.
			Parameters:				
			Returns:
					the file name of the INI file in the form of a string. 
			Example:
					INIFile ini("Origin.ini");;
					int nNumLevels = ini.ReadInt("Config", "NumLevels", 0);
					printf("NumLevels = %d", nNumLevels);
					out_str(ini.GetFileName());
	
	*/
	string	GetFileName();
	
	/**# CP
	
	*/
	//void	SetUseIniPath(BOOL bOn = TRUE);
	
	/**# CP
	
	*/
	//BOOL	GetUseIniPath();
};

/**
		The Registry class provides methods to access data stored in registry
*/
typedef byte* LPBYTE;
typedef uint* LPDWORD;
//
// Reserved Key Handles.
//
#define HKEY_CLASSES_ROOT           ( 0x80000000 )
#define HKEY_CURRENT_USER           ( 0x80000001 )
#define HKEY_LOCAL_MACHINE          ( 0x80000002 )
#define HKEY_USERS                  ( 0x80000003 )
#define HKEY_PERFORMANCE_DATA       ( 0x80000004 )
#define HKEY_CURRENT_CONFIG         ( 0x80000005 )
#define HKEY_DYN_DATA               ( 0x80000006 )

//
// Predefined Value Types.
//
#define REG_NONE                    ( 0 )   // No value type
#define REG_SZ                      ( 1 )   // Unicode nul terminated string
#define REG_EXPAND_SZ               ( 2 )   // Unicode nul terminated string
                                            // (with environment variable references)
#define REG_BINARY                  ( 3 )   // Free form binary
#define REG_DWORD                   ( 4 )   // 32-bit number
#define REG_DWORD_LITTLE_ENDIAN     ( 4 )   // 32-bit number (same as REG_DWORD)
#define REG_DWORD_BIG_ENDIAN        ( 5 )   // 32-bit number
#define REG_LINK                    ( 6 )   // Symbolic Link (unicode)
#define REG_MULTI_SZ                ( 7 )   // Multiple Unicode strings
#define REG_RESOURCE_LIST           ( 8 )   // Resource list in the resource map
#define REG_FULL_RESOURCE_DESCRIPTOR ( 9 )  // Resource list in the hardware description
#define REG_RESOURCE_REQUIREMENTS_LIST ( 10 )

/** >System
*/
class Registry
{
public:
	Registry(DWORD hParentKey);

public:
	/**
		Has the specified registry key or not.
	Parameters:
		lpSubKey = Pointer to a null-terminated string containing the name of the subkey to test. 

	Return:
		TRUE or FALSE.
	Example:
		Registry myRegAccess(HKEY_CLASSES_ROOT);
		if( myRegAccess.HasKey("a\\b\\c") )
			return TRUE;
	SeeAlso:
	*/
	BOOL HasKey(LPCSTR lpSubKey);

	/**
		Removes a named value from the specified registry key.
	Parameters:
		lpSubKey = Pointer to a null-terminated string specifying the name of the key to delete. This parameter cannot be NULL. 
		lpValueName = Pointer to a null-terminated string that names the value to remove. 
					  If this parameter is NULL or points to an empty string, the value set by the SetValue function is removed. 

	Return:
	Example:
		Registry myRegAccess(HKEY_CLASSES_ROOT);
		if( myRegAccess.HasKey("a\\b\\c") )
			myRegAccess.DelValue("a\\b\\c", "MyLabel");
	SeeAlso:
	*/
	BOOL DelValue(LPCSTR lpSubKey, LPCSTR lpValueName = NULL);

	/**
		Deletes a subkey.
	Parameters:
		lpSubKey = Pointer to a null-terminated string specifying the name of the key to delete. This parameter cannot be NULL. 

	Return:
		FALSE if the key does not exist or it fails to remove it.  
	Example:
		Registry myRegAccess(HKEY_CLASSES_ROOT);
		if( myRegAccess.HasKey("a\\b\\c") )
			myRegAccess.DelKey("a\\b\\c");
	SeeAlso:
	*/
	BOOL DelKey(LPCSTR lpSubKey);

	/**
		Retrieves the data for a specified value name associated with a subkey.
	Parameters:
		lpSubKey = Pointer to a null-terminated string containing the name of the subkey to open. 
		lpValueName = Pointer to a string containing the name of the value to query. 
					  If this parameter is NULL or an empty string, "", the function retrieves 
					  the type and data for the key's unnamed or default value, if any.
	Return:
		TRUE if key value pair is in registry, FALSE if not
	Example:
		DWORD dwCntrl;
		Registry myRegAccess(HKEY_CLASSES_ROOT);
		if( myRegAccess.HasKey("a\\b\\c") )
			myRegAccess.GetValue("a\\b\\c", "Control", dwCntrl);
	SeeAlso:
	*/
	BOOL GetValue(LPCSTR lpSubKey, LPCSTR lpValueName, DWORD &dwValue);

	/**
		Retrieves the data for a specified value name associated with a subkey.
	Parameters:
		lpSubKey = Pointer to a null-terminated string containing the name of the subkey to open. 
		lpValueName = Pointer to a string containing the name of the value to query. 
					  If this parameter is NULL or an empty string, "", the function retrieves 
					  the type and data for the key's unnamed or default value, if any.
	Return:
		TRUE if key value pair is in registry, FALSE if not
	Example:
		string strLabel;
		Registry myRegAccess(HKEY_CLASSES_ROOT);
		if( myRegAccess.HasKey("a\\b\\c") )
			myRegAccess.GetValue("a\\b\\c", "Label", strLabel);
	SeeAlso:
	*/
	BOOL GetValue(LPCSTR lpSubKey, LPCSTR lpValueName, string &strValue);

	/**
		Retrieves the data for a specified value name associated with a subkey.
	Parameters:
		lpSubKey = Pointer to a null-terminated string containing the name of the subkey to open. 
		lpValueName = Pointer to a string containing the name of the value to query. 
					  If this parameter is NULL or an empty string, "", the function retrieves 
					  the type and data for the key's unnamed or default value, if any.
		lpData = Pointer to a buffer that receives the value抯 data. This parameter can be NULL if the data is not required.
		lpcbData = Pointer to a variable that specifies the size, in bytes, of the buffer pointed to by the lpData parameter. 
				   When the function returns, this variable contains the size of the data copied to lpData. 
		lpType = Pointer to a variable that receives the type of data associated with the specified value,
				 The lpType parameter can be NULL if the type is not required.
	Return:
	Example:
		byte szValue[MY_BUFSIZE];
		DWORD dwBufLen = MY_BUFSIZE;
		string strSubKey = "Classes\\CLSID\\{B0F21977-8AAB-4632-A73D-528B909C5663}\\InProcServer32";

		Registry myRegAccess(HKEY_CLASSES_ROOT);
		if( myRegAccess.HasKey("a\\b\\c") )
			myRegAccess.GetValue("a\\b\\c", strSubKey, (LPBYTE)szValue, &dwBufLen);
	SeeAlso:
	*/
	BOOL GetValue(LPCSTR lpSubKey, LPCSTR lpValueName, LPBYTE lpData, LPDWORD lpcbData, LPDWORD lpType = NULL);

	/**
		Sets the data for the default or unnamed value of a specified registry key. 
		The data must be a text string.
	Parameters:
		lpSubKey = Pointer to a null-terminated string containing the name of the subkey.
				   If the lpSubKey does not exist, it will be created there
		lpValue = Pointer to a null-terminated string containing the data to set for the default value of the specified key.
		lpValueName = Pointer to a string containing the name of the value, 
					  If lpszValueName is supplied, the name value pair lpszValueName = lpszValue will be created for the key. 
					  If lpszValueName is NULL, the default value of the lpSubKey will be set to lpszValue.
	Return:
	Example:
		string strLabel = "Test";
		Registry myRegAccess(HKEY_CLASSES_ROOT);
		if( myRegAccess.HasKey("a\\b\\c") )
			myRegAccess.SetValue("a\\b\\c", "Label", strLabel);
	SeeAlso:
	*/
	void SetValue(LPCSTR lpSubKey, LPCSTR lpValueName, LPCSTR lpValue);

	/**
		Sets the data for a specified value name associated with a subkey.
	Parameters:
		lpSubKey = Pointer to a null-terminated string containing the name of the subkey to open. 
		lpValueName = Pointer to a string containing the name of the value to set. 
		dwValue = a unsigned int value
	Return:
	Example:
		Registry myRegAccess(HKEY_CLASSES_ROOT);
		if( myRegAccess.HasKey("a\\b\\c") )
			myRegAccess.SetValue("a\\b\\c", "Control", 12345);
	SeeAlso:
	*/
	void SetValue(LPCSTR lpSubKey, LPCSTR lpValueName, DWORD dwValue);
	/**
		Sets the data for the default or unnamed value of a specified registry key. 
	Parameters:
		lpSubKey = Pointer to a null-terminated string containing the name of the subkey.
				   If the lpSubKey does not exist, it will be created there
		lpValueName = Pointer to a string containing the name of the value, 
					  If lpszValueName is NULL, the default value of the lpSubKey will be set to lpszValue.
		lpData = Pointer to a buffer containing the data to be stored with the specified value name. 
		dwType = Specifies a code indicating the type of data pointed to by the lpData parameter.
		dwcbData = Specifies the size of the information pointed to by the lpData parameter, in bytes.
	Return:
	Example:
		Registry myRegAccess(HKEY_CURRENT_USER);
   		vector<byte> vb = {43, 44, 45, 46, 47, 48, 49, 0};
   		DWORD dwType = REG_BINARY;
  		DWORD dwNumBytes = 8;
   
   		if( myRegAccess.HasKey("a\\b\\c") )
      		myRegAccess.SetValue("a\\b\\c", "Place1", vb, dwType, dwNumBytes);
	SeeAlso:
	*/
	void SetValue(LPCSTR lpSubKey, LPCSTR lpValueName, LPBYTE lpData, DWORD dwType, DWORD dwcbData);
};
#endif // _SETTINGS_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -