SaveRegistryEntries Class Reference

This class can be used for saving a list of items into the registry. More...

#include <registry.h>

List of all members.

Public Member Functions

 SaveRegistryEntries ()
 ~SaveRegistryEntries ()
 Standard destructor.
BOOL StartSaving (String_256 *pKeySpecifier, HKEY hSubKey=hAppStateRegKey)
 Starts the process of saving our a series of registry entries e.g. a pathname list. A sub-key to the main section can be specified so that instead of opening the section <program> \ *pKeySpecifier it opens a sub-section to this.
BOOL SaveNextEntry (String_256 *pNextName)
 Saves out the next entry into the opened key.
BOOL StopSaving ()
 Stops the process of saving our a series of registry entries e.g. a pathname list.
HKEY GetRegKey ()

Private Member Functions

 CC_DECLARE_MEMDUMP (SaveRegistryEntries)

Private Attributes

HKEY m_hRegKey
INT32 m_Counter


Detailed Description

This class can be used for saving a list of items into the registry.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/02/97

Definition at line 172 of file registry.h.


Constructor & Destructor Documentation

SaveRegistryEntries::SaveRegistryEntries  )  [inline]
 

Definition at line 177 of file registry.h.

00177 { m_hRegKey = NULL; m_Counter = 0; };

SaveRegistryEntries::~SaveRegistryEntries  ) 
 

Standard destructor.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/02/97

Definition at line 1240 of file registry.cpp.

01241 {
01242     if (m_hRegKey != NULL)
01243         CloseRegKey(m_hRegKey);
01244     return;
01245 }


Member Function Documentation

SaveRegistryEntries::CC_DECLARE_MEMDUMP SaveRegistryEntries   )  [private]
 

HKEY SaveRegistryEntries::GetRegKey  )  [inline]
 

Definition at line 185 of file registry.h.

00185 { return m_hRegKey; }

BOOL SaveRegistryEntries::SaveNextEntry String_256 pNextName  ) 
 

Saves out the next entry into the opened key.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/02/97
Parameters:
pNextName the next bit of data to be saved in the list [INPUTS]
Returns:
TRUE if successful.

Definition at line 1197 of file registry.cpp.

01198 {
01199     if (m_hRegKey == NULL)
01200         return FALSE;
01201 
01202     // Cannot save out the item with a blank name so invent a unique name for it
01203     TCHAR buf[10];
01204     wsprintf(buf, TEXT("%d"), m_Counter + 1);
01205     m_Counter++;
01206 
01207     return SetRegValue(m_hRegKey, buf, REG_SZ, *pNextName, pNextName->Length() + 1);
01208 }

BOOL SaveRegistryEntries::StartSaving String_256 pKeySpecifier,
HKEY  hSubKey = hAppStateRegKey
 

Starts the process of saving our a series of registry entries e.g. a pathname list. A sub-key to the main section can be specified so that instead of opening the section <program> \ *pKeySpecifier it opens a sub-section to this.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/02/97
Parameters:
pKeySpecifier string specifying the key name to store the data under [INPUTS] hSubKey the sub key to start the section under, defaults to the main program section of the regsitry
Returns:
TRUE if successful.

Definition at line 1149 of file registry.cpp.

01150 {
01151     // Don't do this under Win32s.
01152     if (IsWin32s() && !IsWin32c()) return FALSE;
01153 
01154     ERROR2IF(hSubKey == NULL, FALSE, "SaveRegistryEntries::StartSaving Bad main app key");
01155     ERROR2IF(pKeySpecifier == NULL, FALSE, "SaveRegistryEntries::StartSaving Bad key specifier");
01156     ERROR2IF(m_hRegKey != NULL, FALSE, "SaveRegistryEntries::StartSaving hRegKey is already non-null");
01157 
01158     // Ensure the section is blank before we start saving any data
01159     DeleteRegKey(hSubKey, *pKeySpecifier);
01160 
01161     // First open/create a new sub-key under the app-state key for holding the data.
01162     // e.g. TEXT("Workspace\\MDI")
01163     // Use the passed in key which will default to the main app hAppStateRegKey if not supplied
01164     m_hRegKey = CreateRegKey(hSubKey, *pKeySpecifier);
01165     if (m_hRegKey == NULL)
01166     {
01167         ERROR3("Can't get a registry key in SaveRegistryEntries::StartSaving");
01168         return FALSE;
01169     }
01170 
01171     // Ensure the section is blank before we start saving any data
01172 /*  BOOL ok = TRUE;
01173     TCHAR buf[10];
01174     INT32 i = 0;
01175     while (ok)
01176     {
01177         wsprintf(buf, TEXT("%d"), i + 1);
01178         i++;
01179         ok = DeleteRegKey(m_hRegKey, buf);
01180     }
01181 */
01182     return TRUE;
01183 }

BOOL SaveRegistryEntries::StopSaving  ) 
 

Stops the process of saving our a series of registry entries e.g. a pathname list.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/02/97
Returns:
TRUE if successful.

Definition at line 1222 of file registry.cpp.

01223 {
01224     ERROR2IF(m_hRegKey == NULL, FALSE, "hRegKey is null");
01225     BOOL closed = CloseRegKey(m_hRegKey);
01226     m_hRegKey = NULL;
01227     return closed;
01228 }


Member Data Documentation

INT32 SaveRegistryEntries::m_Counter [private]
 

Definition at line 189 of file registry.h.

HKEY SaveRegistryEntries::m_hRegKey [private]
 

Definition at line 188 of file registry.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:38 2007 for Camelot by  doxygen 1.4.4