-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_dlg.cpp
54 lines (42 loc) · 1.59 KB
/
base_dlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// GNU LESSER GENERAL PUBLIC LICENSE
// Version 3, 29 June 2007
//
// Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
//
// Everyone is permitted to copy and distribute verbatim copies of this license
// document, but changing it is not allowed.
//
// This version of the GNU Lesser General Public License incorporates the terms
// and conditions of version 3 of the GNU General Public License, supplemented
// by the additional permissions listed below.
#include "stdafx.h"
#include "base_dlg.h"
IMPLEMENT_DYNAMIC(CBaseDlg, CDialog)
BEGIN_MESSAGE_MAP(CBaseDlg, CDialog)
ON_WM_DESTROY()
ON_MESSAGE(WM_DPICHANGED, OnDpiChanged)
END_MESSAGE_MAP()
CBaseDlg::CBaseDlg() : m_dpi_behavior{false} {}
CBaseDlg::CBaseDlg(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
: CDialog{lpszTemplateName, pParentWnd}, m_dpi_behavior{false} {}
CBaseDlg::CBaseDlg(UINT nIDTemplate, CWnd* pParentWnd)
: CDialog{nIDTemplate, pParentWnd}, m_dpi_behavior{false} {}
CBaseDlg::~CBaseDlg() = default;
BOOL CBaseDlg::OnInitDialog() {
const BOOL rc{__super::OnInitDialog()};
// dimhotepus: Try to add main icon for dialog.
HANDLE hExeIcon = LoadImageW(GetModuleHandleW(nullptr), MAKEINTRESOURCEW(101),
IMAGE_ICON, 0, 0, LR_SHARED);
if (hExeIcon) {
SendMessage(WM_SETICON, ICON_BIG, (LPARAM)hExeIcon);
}
m_dpi_behavior.OnCreateWindow(m_hWnd);
return rc;
}
void CBaseDlg::OnDestroy() {
m_dpi_behavior.OnDestroyWindow();
__super::OnDestroy();
}
LRESULT CBaseDlg::OnDpiChanged(WPARAM wParam, LPARAM lParam) {
return m_dpi_behavior.OnWindowDpiChanged(wParam, lParam);
}