Rev 1 | Blame | Compare with Previous | Last modification | View Log
/*Module : HKLM.HPurpose: Interface for a class to provide simpleaccess to the HKEY_LOCAL_MACHINE\Software\Company\MyAppregistry key similiar to the functions MFC providesto access the same settings in HKEY_CURRENT_USERCreated: PJN / 27-07-1998Copyright (c) 1998 - 2001 by PJ Naughter. (Web: www.naughter.com, Email: pjna@naughter.com)All rights reserved.Copyright / Usage Details:You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise)when your product is released in binary form. You are allowed to modify the source code in any way you wantexcept you cannot modify the copyright details at the top of each module. If you want to distribute sourcecode with your application, then you are only allowed to distribute versions released by the author. This isto maintain a single distribution point for the source code.*/#ifndef __HKLM_H__#define __HKLM_H__class CHKLM{public://Perform the same job as the function of the same name// in the CWinApp class in MFCvoid SetRegistryKey(char *lpszRegistryKey);void SetRegistryKey(UINT nIDRegistryKey);//Allows you to customize the "Product Name" registry key. If you do not//call SetAppRegistryKey, then "AfxGetApp()->m_pszAppName" is//used by defaultvoid SetProductNameRegistryKey(LPCTSTR lpszProductNameRegistryKey);void SetProductNameRegistryKey(UINT nIDProductNameRegistryKey);CString GetProductNameRegistryKey() const;//Allows saving and restoring of a profile settings to the//HKEY_LOCAL_MACHINE\Software\"Company Name"\"Product Name"//registry key. These classes are modelled upon the functions//of the same name in the CWinApp class in MFCBOOL WriteProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszValue);BOOL WriteProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nValue);CString GetProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault = NULL);UINT GetProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nDefault);BOOL GetProfileBinary(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPBYTE* ppData, UINT* pBytes);BOOL WriteProfileBinary(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPBYTE pData, UINT nBytes);BOOL GetProfileStringArray(LPCTSTR lpszSection, LPCTSTR lpszEntry, CStringArray& array);BOOL WriteProfileStringArray(LPCTSTR lpszSection, LPCTSTR lpszEntry, const CStringArray& array);protected://Misc functionsHKEY GetAppRegistryKey(BOOL bReadOnly = FALSE);HKEY GetSectionKey(LPCTSTR lpszSection, BOOL bReadOnly = FALSE);BOOL GetStringArrayFromRegistry(HKEY hKey, LPCTSTR lpszEntry, CStringArray& array);BOOL SetStringArrayIntoRegistry(HKEY hKey, LPCTSTR lpszEntry, const CStringArray& array);//Member variablesCString m_sRegistryKey;CString m_sProductNameRegistryKey;};#endif //__HKLM_H__