#keywords C, Windows, Shell, 바탕화면 {{{#!gcode HRESULT hr; LPSHELLFOLDER lpsf = NULL; hr = ::SHGetDesktopFolder(&lpsf); if (FAILED(hr)) throw CString(_T("SHGetDestktopFolder error")); IEnumIDList* pEnumIDList = NULL; hr = lpsf->EnumObjects(::GetParent(m_hWnd), SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &pEnumIDList); if (FAILED(hr)) throw CString(_T("lpsf->EnumObjects error")); LPITEMIDLIST pItemIDList; ULONG fetched; while (pEnumIDList->Next(1, &pItemIDList, &fetched) == S_OK) { ULONG attrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER; // 획득하려는 속성 hr = lpsf->GetAttributesOf(1, (const struct _ITEMIDLIST**)&pItemIDList, &attrs); if (hr != S_OK) throw CString(_T("lpsf->GettAttributesOf error")); STRRET str; // 이름을 받을 구조체 hr = lpsf->GetDisplayNameOf(pItemIDList, SHGDN_NORMAL, &str); if (hr != S_OK) throw CString(_T("lpsp->GetDisplayNameOf error")); TCHAR displayName[MAX_PATH]; switch (str.uType) { case STRRET_CSTR: // 획득 문자열이 cStr 멤버에 있다. MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, str.cStr, strlen(str.cStr), displayName, MAX_PATH); break; case STRRET_WSTR: // 획득 문자열이 pOleStr 멤버에 있다. (유니코드) lstrcpy(displayName, str.pOleStr); break; default: throw CString(_T("lpsp->GetDisplayNameOf error")); } AfxMessageBox(displayName); } }}} ---- {{{ [컴퓨터]-[휴지통]-[제어판]-[USER_NAME]-[라이브러리]-[네트워크]-... }}}