MCPcopy Create free account
hub / github.com/ColorCop/ColorCop / GetShellFolderPath

Method GetShellFolderPath

ColorCop/ColorCopDlg.cpp:2220–2244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2218}
2219
2220BOOL CColorCopDlg::GetShellFolderPath(LPCTSTR pShellFolder, LPTSTR pShellPath) {
2221 // pShellFolder can be one of the following
2222 // AppData, Cache, Cookies, Desktop, Favorites, Fonts, History, NetHood,
2223 // Personal, Printhood, Programs, Recent, SendTo, Start Menu, Startup,
2224 // Templates, ShellNew
2225 DWORD rc;
2226 DWORD length = MAX_PATH;
2227 DWORD type = REG_SZ;
2228 HKEY hkey;
2229
2230 rc = RegOpenKeyEx(HKEY_CURRENT_USER,
2231 _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"),
2232 0, KEY_READ, &hkey);
2233
2234 if (rc == ERROR_SUCCESS) {
2235 rc = RegQueryValueEx(hkey, pShellFolder, NULL, &type,
2236 reinterpret_cast<BYTE*>(pShellPath), &length);
2237 RegCloseKey(hkey);
2238 }
2239
2240 if (rc == ERROR_SUCCESS)
2241 return TRUE;
2242 else
2243 return FALSE;
2244}
2245
2246void CColorCopDlg::OnDestroy() {
2247 // Capture and store the dialog’s last on-screen position so it can be

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected