From cc6ab00b71cee9d841d7cd97e6ff7b48e9c281e3 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 28 Feb 2021 13:33:06 +0000 Subject: [PATCH] Remove border on Windows GUI About box. The About text is in a readonly edit control rather than a static control, so that it can be copy-pasted. Previously, I haven't managed to avoid the side effect of the edit control being surrounded by a border - but now I've finally found out how you can do it: clear all the border styles and _then_ use SetWindowPos to force a redraw of the frame. --- windows/windlg.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/windows/windlg.c b/windows/windlg.c index b26f8d90..8f0b6053 100644 --- a/windows/windlg.c +++ b/windows/windlg.c @@ -205,6 +205,19 @@ static INT_PTR CALLBACK LicenceProc(HWND hwnd, UINT msg, return 0; } +static void MakeDlgItemBorderless(HWND parent, int id) +{ + HWND child = GetDlgItem(parent, id); + LONG_PTR style = GetWindowLongPtr(child, GWL_STYLE); + LONG_PTR exstyle = GetWindowLongPtr(child, GWL_EXSTYLE); + style &= ~WS_BORDER; + exstyle &= ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE | WS_EX_WINDOWEDGE); + SetWindowLongPtr(child, GWL_STYLE, style); + SetWindowLongPtr(child, GWL_EXSTYLE, exstyle); + SetWindowPos(child, NULL, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); +} + static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -222,6 +235,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg, "\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved."); sfree(buildinfo_text); SetDlgItemText(hwnd, IDA_TEXT, text); + MakeDlgItemBorderless(hwnd, IDA_TEXT); sfree(text); return 1; }