반응형
Bursh Name
CString OutlookManager::GetContactCategoryForVer2003() { CString tempCategory = _T(""); //if(_ContactCategory.IsEmpty()) //{ //Get Data, Reg.Category Data to CString HKEY hKey; LONG lResult = RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Office\\11.0\\Outlook\\Categories", 0, KEY_READ, &hKey); if (lResult == ERROR_SUCCESS) { DWORD buf_size = 0; if (RegQueryValueEx(hKey, L"MasterList", NULL, NULL, NULL, &buf_size) == ERROR_SUCCESS){ TCHAR *pBuf = new TCHAR[buf_size + 1]; if(RegQueryValueEx(hKey, L"MasterList", NULL, NULL, (LPBYTE)pBuf, &buf_size) == ERROR_SUCCESS) { pBuf[buf_size] = _T('\0'); tempCategory = CString(pBuf); } delete[] pBuf; pBuf = NULL; } } RegCloseKey(hKey); return _ContactCategory = tempCategory; //}else{ // return _ContactCategory; //} } void OutlookManager::SetContactCategoryForVer2003(CString value) { //Get Data, Reg.Category Data to CString HKEY hKey; LONG lResult = RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Office\\11.0\\Outlook\\Categories", 0, KEY_WRITE, &hKey); if (lResult == ERROR_SUCCESS) { //Set TCHAR *pBuf = NULL; pBuf = (TCHAR*)(LPCTSTR)value; DWORD size = (_tcslen(pBuf) + 1) * 2; lResult = RegSetValueEx(hKey, L"MasterList", 0, REG_BINARY, (LPBYTE)pBuf, size); } CString test = GetContactCategoryForVer2003(); RegCloseKey(hKey); }
반응형
'I.T > Programming' 카테고리의 다른 글
[C++]Tokenize 예제, C#의 Split (0) | 2014.01.14 |
---|---|
[C++]RegOpenKeyEx, RegQueryValueEx, RegSetValueEx (CString, TCHAR) (0) | 2014.01.14 |
Float to Int, Double to Int 형변환 때 -1 되는 현상 (0) | 2013.09.30 |
암복호화 관련한 용어 팁, Encrypt, Decrypt, Mode, Padding (0) | 2013.06.18 |
WPF 개발자가 MVVM을 선호하는 이유 (3) | 2013.02.20 |