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

Method OnInitDialog

WinArk/NumberValueDlg.cpp:23–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23LRESULT CNumberValueDlg::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) {
24 ATLASSERT(m_Type == REG_DWORD || m_Type == REG_QWORD);
25 m_Value = 0;
26 ULONG bytes = m_Type == REG_DWORD ? 4 : 8;
27 DWORD type;
28 if (ERROR_SUCCESS != m_Key.QueryValue(m_Name, &type, &m_Value, &bytes)) {
29 EndDialog(IDRETRY);
30 return 0;
31 }
32 ATLASSERT(m_Type == type);
33 SetWindowText(m_Type == REG_DWORD ? L"DWORD Value" : L"QWORD Value");
34 SetDlgItemText(IDC_NAME, m_Name.IsEmpty() ? RegHelpers::DefaultValueName : m_Name);
35 DisplayValue(m_Value);
36
37 if (m_ReadOnly)
38 ((CEdit)GetDlgItem(IDC_VALUE)).SetReadOnly(TRUE);
39
40 if (m_Type == REG_QWORD) {
41 GetDlgItem(IDC_COLOR).ShowWindow(SW_HIDE);
42 int extra = 120;
43 CRect rc;
44 GetWindowRect(&rc);
45 SetWindowPos(nullptr, 0, 0, rc.Width() + extra, rc.Height(), SWP_NOMOVE | SWP_NOREPOSITION);
46 GetDlgItem(IDC_VALUE).GetClientRect(&rc);
47 GetDlgItem(IDC_VALUE).SetWindowPos(nullptr, 0, 0, rc.right + extra, rc.bottom, SWP_NOMOVE | SWP_NOREPOSITION);
48 }
49
50 return 0;
51}
52
53LRESULT CNumberValueDlg::OnCloseCmd(WORD, WORD wID, HWND, BOOL&) {
54 if (IDOK == wID) {

Callers

nothing calls this directly

Calls 3

QueryValueMethod · 0.80
IsEmptyMethod · 0.80
SetReadOnlyMethod · 0.80

Tested by

no test coverage detected