//-----------------------------------------------------------------------------+ // Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd. // = FileName : TRegProperty.h // = Version : ver2.0 // = Author : xlc // = CreateDate : 2002-09-09 // = Description: 类的声明 // = Maintainers: // //-----------------------------------------------------------------------------+ #ifndef _TREGPROPERTY_H_ #define _TREGPROPERTY_H_ #ifndef _TREGOBJECT_H_ #include "TRegObject.h" #endif class TRegProperty : public TRegObject { public : TRegProperty ( const TRegProperty &); TRegProperty ( LPCTSTR pszRootKey, LPCTSTR pszObjKey); TRegProperty ( LPCTSTR pszRootKey, LPCTSTR pszObjKey, double dVersion); virtual ~TRegProperty (); virtual bool Init (); virtual bool Read (); virtual bool Store (); TRegProperty & operator = ( const TRegProperty & ); CString GetVersion () const; CString GetRootKey ( bool bVersionized) const; void SetRootKey ( LPCTSTR pszRootKey , double dVersion ); void Register ( TRegObject * obj ); void Unregister( TRegObject * obj ); bool LookUp ( TRegObject * pobjLook , int *pIndex = NULL ); TRegObject * LookUp ( DWORD_PTR hSubkey ); DWORD_PTR CreateSubKey ( LPCTSTR pszSubkey , bool bVersionized = FALSE , LPCTSTR pszClassname = NULL ); TRegObject * GetRegObject ( DWORD_PTR Handle ); bool AttachValue ( DWORD_PTR hSubkey , int *nValue , LPCTSTR pszName ); bool AttachValue ( DWORD_PTR hSubkey , bool *bValue , LPCTSTR pszName ); bool AttachValue ( DWORD_PTR hSubkey , long *lValue , LPCTSTR pszName ); bool AttachValue ( DWORD_PTR hSubkey , DWORD *dwValue , LPCTSTR pszName ); bool AttachValue ( DWORD_PTR hSubkey , CString *strValue , LPCTSTR pszName ); typedef enum { RegPTypeNONE, RegPTypeLOCAL_MACHINE, RegPTypeUSERS } RegPropertyType ; static bool ReadValue ( HKEY key, const TCHAR * pszKey, const TCHAR * pszValuename, BYTE *pBuffer, DWORD BufferSize); protected : TRegProperty (); private: void init (); void clear (); private: bool m_bDeleting; CString m_RootKey; CString m_Version; CString m_VersionKey; CString m_CommonKey; CPtrArray m_CRegObjectArray; RegPropertyType m_RegPropertyType; }; #endif