MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / OnInitDialog

Method OnInitDialog

WinArk/MultiStringValueDlg.cpp:18–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18LRESULT CMultiStringValueDlg::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) {
19 ULONG chars = 0;
20 m_Key.QueryMultiStringValue(m_Name, nullptr, &chars);
21 if (chars) {
22 chars++;
23 auto buffer = std::make_unique<WCHAR[]>(chars);
24 ZeroMemory(buffer.get(), chars * sizeof(WCHAR));
25 DWORD type;
26 auto len = chars * 2;
27 if (ERROR_SUCCESS != ::RegQueryValueEx(m_Key.Get(), m_Name, nullptr, &type, (PBYTE)buffer.get(), &len)) {
28 EndDialog(IDRETRY);
29 return 0;
30 }
31 std::for_each(buffer.get(), buffer.get() + chars - 1, [](auto& ch) {
32 if (ch == 0)
33 ch = L'\n';
34 });
35 m_Value = buffer.get();
36 m_Value.Replace(L"\n", L"\r\n");
37 SetDlgItemText(IDC_VALUE, m_Value);
38 }
39 if (m_ReadOnly) {
40 ((CEdit)GetDlgItem(IDC_VALUE)).SetReadOnly(TRUE);
41 }
42 SetDlgItemText(IDC_NAME, m_Name.IsEmpty() ? RegHelpers::DefaultValueName : m_Name);
43
44 return TRUE;
45}
46
47LRESULT CMultiStringValueDlg::OnCloseCmd(WORD, WORD id, HWND, BOOL&) {
48 if (id == IDOK) {

Callers

nothing calls this directly

Calls 5

QueryMultiStringValueMethod · 0.80
ReplaceMethod · 0.80
SetReadOnlyMethod · 0.80
IsEmptyMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected