void COptionsDirectoriesPage::SelectDirectory(LanguageStringID Title, CModifiedEditBox & EditBox, CModifiedButton & Default, CModifiedButton & selected) { wchar_t Buffer[MAX_PATH], Directory[MAX_PATH]; LPITEMIDLIST pidl; BROWSEINFOW bi; stdstr InitialDir = EditBox.GetWindowText(); bi.hwndOwner = m_hWnd; bi.pidlRoot = NULL; bi.pszDisplayName = Buffer; bi.lpszTitle = GS(Title); bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; bi.lpfn = (BFFCALLBACK)SelectDirCallBack; bi.lParam = (DWORD)InitialDir.c_str(); if ((pidl = SHBrowseForFolderW(&bi)) != NULL) { if (SHGetPathFromIDListW(pidl, Directory)) { stdstr path; CPath SelectedDir(path.FromUTF16(Directory), ""); EditBox.SetChanged(true); EditBox.SetWindowText(SelectedDir); Default.SetChanged(true); Default.SetCheck(BST_UNCHECKED); selected.SetCheck(BM_SETCHECK); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); } } }
void COptionsDirectoriesPage::ResetDirectory(CModifiedEditBox & EditBox, SettingID Type) { if (!EditBox.IsChanged()) { return; } stdstr dir; g_Settings->LoadDefaultString(Type, dir); EditBox.SetWindowText(dir.c_str()); EditBox.SetReset(true); }
void CAdvancedOptionsPage::SelectFile(LanguageStringID Title, CModifiedEditBox & EditBox) { // Open DDROM OPENFILENAME openfilename; char FileName[_MAX_PATH], Directory[_MAX_PATH]; memset(&FileName, 0, sizeof(FileName)); memset(&openfilename, 0, sizeof(openfilename)); strcpy(Directory, g_Settings->LoadStringVal(RomList_GameDir).c_str()); openfilename.lStructSize = sizeof(openfilename); openfilename.hwndOwner = m_hWnd; openfilename.lpstrFilter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0"; openfilename.lpstrFile = FileName; openfilename.lpstrInitialDir = Directory; openfilename.nMaxFile = MAX_PATH; openfilename.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; if (GetOpenFileName(&openfilename)) { EditBox.SetChanged(true); EditBox.SetWindowText(FileName); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); } }