CobaltFusion / DebugViewPP

DebugView++, collects, views, filters your application logs, and highlights information that is important to you!
Boost Software License 1.0
982 stars 144 forks source link

Window is outside visible screen on multi monitor setup #314

Closed tripplet closed 6 years ago

tripplet commented 6 years ago

Hi,

DebugView can start offscreen if the x or y stored in the registry are to big.

The code at: https://github.com/CobaltFusion/DebugViewPP/blob/8a2f58b16498768361c38b80b0f7f533fe54d499/DebugView%2B%2B/MainFrame.cpp#L674-L678 Seems to be there to fix this, but this does not work if the primary monitor is on the right side. GetSystemMetrics(SM_CXVIRTUALSCREEN) gives the full multi monitor width but the range in reality is for example -1920 to 1920, where x=0 is on the left side of the right (primary) monitor. The error can be reproduced with changing the primary monitor between execution (At least on my windows 10 machine). Maybe this behavior is different on older versions of windows, I don't known.

See: https://blogs.msdn.microsoft.com/oldnewthing/20100820-00/?p=13093

Best solution seems to be described here: https://msdn.microsoft.com/de-de/library/windows/desktop/dd162826.aspx

Sadly I currently don't have a vsstudio setup for creating a proper pull request with the change.

Hope this minor announce can be fixed.

Thanks Tobi

janwilmans commented 6 years ago

Great analysis, I have seen this, but until now did not understand why it was happening... I think I'll be able to fix it now :)

janwilmans commented 6 years ago

Tested, this is the error scenario:

Also tested on windows 8.1 and windows 7. @tripplet your fix worked, thanks ! and thanks for explaining why it works :)