| 20 | } |
| 21 | |
| 22 | LRESULT CStringValueDlg::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) { |
| 23 | ULONG chars = 0; |
| 24 | m_Key.QueryStringValue(m_Name, nullptr, &chars); |
| 25 | if (chars) { |
| 26 | auto buffer = std::make_unique<WCHAR[]>(chars); |
| 27 | if (ERROR_SUCCESS != m_Key.QueryStringValue(m_Name, buffer.get(), &chars)) { |
| 28 | EndDialog(IDRETRY); |
| 29 | return 0; |
| 30 | } |
| 31 | SetDlgItemText(IDC_VALUE, m_Value = buffer.get()); |
| 32 | } |
| 33 | |
| 34 | m_Key.QueryValue(m_Name, &m_Type, nullptr, nullptr); |
| 35 | ATLASSERT(m_Type == REG_SZ || m_Type == REG_EXPAND_SZ); |
| 36 | CheckDlgButton(m_Type == REG_SZ ? IDC_STRING : IDC_EXPANDSZ, BST_CHECKED); |
| 37 | |
| 38 | if (m_ReadOnly) { |
| 39 | ((CEdit)GetDlgItem(IDC_VALUE)).SetReadOnly(TRUE); |
| 40 | GetDlgItem(IDC_STRING).EnableWindow(FALSE); |
| 41 | GetDlgItem(IDC_EXPANDSZ).EnableWindow(FALSE); |
| 42 | } |
| 43 | else { |
| 44 | ::SHAutoComplete(GetDlgItem(IDC_VALUE), SHACF_FILESYS_DIRS); |
| 45 | } |
| 46 | SetDlgItemText(IDC_NAME, m_Name.IsEmpty() ? RegHelpers::DefaultValueName : m_Name); |
| 47 | |
| 48 | return TRUE; |
| 49 | } |
| 50 | |
| 51 | LRESULT CStringValueDlg::OnCloseCmd(WORD, WORD wID, HWND, BOOL&) { |
| 52 | if (wID == IDOK) { |
nothing calls this directly
no test coverage detected