/** * @file XTPPropExchangeRegistry.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPPROPEXCHANGEREGISTRY_H__) # define __XTPPROPEXCHANGEREGISTRY_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * CXTPPropExchangeRegistry is CXTPPropExchange derived class. * The CXTPPropExchangeRegistry class allows you to save a complex network of objects in a * system registry that persists after those objects are deleted. Later you can load the objects * from persistent storage, reconstituting them in memory. This process of making data * persistent is called 'serialization.' * * Example: *
 * HKEY hKey = AfxGetApp()->GetAppRegistryKey();
 * CXTPPropExchangeRegistry px(FALSE, hKey, szSection);
 * DoPropExchange(&px);
 * RegCloseKey(hKey);
 * 
*/ class _XTP_EXT_CLASS CXTPPropExchangeRegistry : public CXTPPropExchange { /** @cond */ DECLARE_DYNAMIC(CXTPPropExchangeRegistry) /** @endcond */ public: /** * @brief * Constructs CXTPPropExchangeRegistry a object. * @param bLoading A flag that specifies whether objects will be loaded from or stored. * @param hParentKey Root HKEY * @param lpszSection Points to a null-terminated string that specifies the section containing * the entry. */ CXTPPropExchangeRegistry(BOOL bLoading, HKEY hParentKey, LPCTSTR lpszSection); /** * @brief * Destroys a CXTPPropExchangeRegistry object, handles cleanup and * deallocation. */ ~CXTPPropExchangeRegistry(); /** * @brief * Exchanges a property between a storage medium and the control. * @param pszPropName The name of the property being exchanged. * @param vtProp A symbol specifying the type of the property being * exchanged. * @param pvProp A pointer to the property's value. * @param pvDefault Pointer to a default value for the property. * @details * Possible values of properties are: *
	 * Symbol         Property Type
	 * -------------  -------------
	 * VT_I2          short
	 * VT_I4          long
	 * VT_BOOL        BOOL
	 * VT_BSTR        CString
	 * VT_CY          CY
	 * VT_R4          float
	 * VT_R8          double
	 * 
* @return * Nonzero if the exchange was successful; 0 if unsuccessful. */ virtual BOOL ExchangeProp(LPCTSTR pszPropName, VARTYPE vtProp, void* pvProp, const void* pvDefault = NULL); /** * @brief * This method serializes a property that stores binary large object (BLOB) data. * @param pszPropName The name of the property being exchanged. * @param pData A pointer to a user-supplied buffer that contains the data to be * serialized * @param nBytes An integer that specifies the number of bytes to be read or written. * @return * Nonzero if the exchange was successful; 0 if unsuccessful. */ virtual BOOL ExchangeBlobProp(LPCTSTR pszPropName, BYTE*& pData, DWORD& nBytes); /** * @brief * Call this method to check if section exists. * @param lpszSection The name of the section being checked. * @return True if section exists, false is not */ BOOL IsSectionExists(LPCTSTR lpszSection); /** * @brief * Call this method to check if property entry exists. * @param pszPropName The name of the property being checked. * @return True if section exists, false is not */ BOOL IsPropertyExists(LPCTSTR pszPropName); /** * @brief * This method creates new section for text base storages (CXTPPropExchangeXMLNode and * CXTPPropExchangeRegistry) * @param lpszSection The name of the section. * @return * CXTPPropExchange pointer to new section. You must delete this pointer or use * CXTPPropExchangeSection to manage it. * * Example: *
	 * CXTPPropExchangeSection pxTaskPanel(px.GetSection(_T("TaskPanel")));
	 * m_wndTaskPanel.GetGroups()->DoPropExchange(&pxTaskPanel);
	 * 
*/ virtual CXTPPropExchange* GetSection(LPCTSTR lpszSection); /** * @brief * Call this method to free section information before storing */ virtual void EmptySection(); /** * @brief * This method is called before exchange properties. * @return * TRUE if storage ready to exchange properties. */ virtual BOOL OnBeforeExchange(); /** * @brief * Call this method to determine if storage allows exchange plain blob values. * @return * TRUE if storage allows exchange plain blob values. */ virtual BOOL IsAllowBlobValues() const; private: LONG DelRegTreeHelper(HKEY hParentKey, LPCTSTR lpszKeyName); protected: HKEY m_hSectionKey; /**< Current registry key */ HKEY m_hParentKey; /**< Parent registry key */ CString m_strSectionName; /**< Section name */ BOOL m_bCloseParentKey; /**< TRUE to automatically close parent key */ }; AFX_INLINE BOOL CXTPPropExchangeRegistry::IsAllowBlobValues() const { return TRUE; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPPROPEXCHANGEREGISTRY_H__) /** @endcond */