1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2020 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 static BOOL CALLBACK
MonitorEnum(HMONITOR hMon
, HDC
/*hdc*/, LPRECT lprcMonitor
, LPARAM pData
)
27 MONITORINFOEX miex
= { 0 };
28 miex
.cbSize
= sizeof(MONITORINFOEX
);
29 GetMonitorInfo(hMon
, &miex
);
31 if (miex
.dwFlags
== DISPLAY_DEVICE_MIRRORING_DRIVER
)
34 std::vector
<RECT
>* pMonRects
= reinterpret_cast<std::vector
<RECT
>*>(pData
);
35 pMonRects
->push_back(*lprcMonitor
);
39 std::wstring
GetMonitorSetupHash()
41 std::vector
<RECT
> monRects
;
42 EnumDisplayMonitors(0, 0, MonitorEnum
, reinterpret_cast<LPARAM
>(&monRects
));
43 std::sort(monRects
.begin(), monRects
.end(),
44 [](const RECT
& a
, const RECT
& b
) -> bool {
47 return a
.left
< b
.left
;
49 return GetHashText(monRects
.data(), monRects
.size() * sizeof(RECT
), HashType::HashMd5
);