summaryrefslogtreecommitdiff
path: root/src/core/stdmsg
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-17 21:21:50 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-17 21:21:50 +0300
commit02e7a43880dd6e0b44f0b6776d7d0ce85d08df8a (patch)
treec2f7ab333c717b6cec0cbbab546982250fa610a9 /src/core/stdmsg
parentb6bb2574a234f205b4809aa3b4a37788a8a85063 (diff)
ok, let's check hdc
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index d9c5acbb39..d552a0ae64 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -745,18 +745,19 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
DeleteObject(copy);
}
- HDC dc = GetDCEx(m_message.GetHwnd(), region, DCX_WINDOW | DCX_CACHE | DCX_INTERSECTRGN | DCX_LOCKWINDOWUPDATE);
+ if (HDC hdc = GetDCEx(m_message.GetHwnd(), region, DCX_WINDOW | DCX_CACHE | DCX_INTERSECTRGN | DCX_LOCKWINDOWUPDATE)) {
+ HPEN pen = CreatePen(PS_INSIDEFRAME, 1, RGB(0, 220, 0));
+ HGDIOBJ old = SelectObject(hdc, pen);
+ int width = rect.right - rect.left;
+ int height = rect.bottom - rect.top;
+ Rectangle(hdc, 0, 0, width, height);
+ SelectObject(hdc, old);
+ ReleaseDC(m_message.GetHwnd(), hdc);
+ DeleteObject(pen);
+ }
+
if (region)
DeleteObject(region);
-
- HPEN pen = CreatePen(PS_INSIDEFRAME, 1, RGB(0, 220, 0));
- HGDIOBJ old = SelectObject(dc, pen);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- Rectangle(dc, 0, 0, width, height);
- SelectObject(dc, old);
- ReleaseDC(m_message.GetHwnd(), dc);
- DeleteObject(pen);
return 0;
}
break;