[DESK] Set some flags for Browse for Wallpaper dialog (#2699)

* [DESK] Add initial directory flag and set it to My Pictures. Also set OFN_EXPLORER style.

* Use CSIDL_MYPICTURES instead of environment variable concoction.

* Fix formatting.
This commit is contained in:
Jared Smudde 2020-04-30 03:10:40 -05:00 committed by GitHub
parent 8f3079c67f
commit 96e6cee044
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -635,6 +635,7 @@ OnBrowseButton(HWND hwndDlg, PBACKGROUND_DATA pData)
OPENFILENAME ofn; OPENFILENAME ofn;
TCHAR filename[MAX_PATH]; TCHAR filename[MAX_PATH];
TCHAR fileTitle[256]; TCHAR fileTitle[256];
TCHAR initialDir[MAX_PATH];
LPTSTR filter; LPTSTR filter;
LPTSTR extensions; LPTSTR extensions;
BackgroundItem *backgroundItem = NULL; BackgroundItem *backgroundItem = NULL;
@ -652,6 +653,7 @@ OnBrowseButton(HWND hwndDlg, PBACKGROUND_DATA pData)
hwndBackgroundList = GetDlgItem(hwndDlg, IDC_BACKGROUND_LIST); hwndBackgroundList = GetDlgItem(hwndDlg, IDC_BACKGROUND_LIST);
himl = ListView_GetImageList(hwndBackgroundList, LVSIL_SMALL); himl = ListView_GetImageList(hwndBackgroundList, LVSIL_SMALL);
SHGetFolderPathW(NULL, CSIDL_MYPICTURES, NULL, 0, initialDir);
ZeroMemory(&ofn, sizeof(OPENFILENAME)); ZeroMemory(&ofn, sizeof(OPENFILENAME));
@ -706,8 +708,8 @@ OnBrowseButton(HWND hwndDlg, PBACKGROUND_DATA pData)
ofn.nFilterIndex = 0; ofn.nFilterIndex = 0;
ofn.lpstrFileTitle = fileTitle; ofn.lpstrFileTitle = fileTitle;
ofn.nMaxFileTitle = 256; ofn.nMaxFileTitle = 256;
ofn.lpstrInitialDir = NULL; ofn.lpstrInitialDir = initialDir;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER;
success = GetOpenFileName(&ofn); success = GetOpenFileName(&ofn);
HeapFree(GetProcessHeap(), 0, filter); HeapFree(GetProcessHeap(), 0, filter);