-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Win32Exception on closing window #2792
Comments
Closing a maximized window was enough, as far as I remember. |
By using the window button ofc.. |
Hm, works fine on my machine. Do you remember the bug in the ControlzEx appeared always or with some HW + OS configuration only? Thanks. |
@xmedeko I think the error can be reproduced with this setting...
the error happens in this method by calling the private IntPtr _HandleMoveForRealSize(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled)
{
/*
* This is a workaround for wrong windows behaviour (with multi monitor system).
* If a Window sets the WindoStyle to None and WindowState to maximized
* we can move the Window to different monitor with maybe different dimension.
* But after moving to the previous monitor we got a wrong size (from the old monitor dimension).
*/
WindowState state = _GetHwndState();
if (state == WindowState.Maximized) {
IntPtr monitorFromWindow = NativeMethods.MonitorFromWindow(_hwnd, (uint)MonitorOptions.MONITOR_DEFAULTTONEAREST);
if (monitorFromWindow != IntPtr.Zero)
{
var ignoreTaskBar = _chromeInfo.IgnoreTaskbarOnMaximize;// || _chromeInfo.UseNoneWindowStyle;
MONITORINFO monitorInfo = NativeMethods.GetMonitorInfoW(monitorFromWindow);
RECT rcMonitorArea = ignoreTaskBar ? monitorInfo.rcMonitor : monitorInfo.rcWork;
/*
* ASYNCWINDOWPOS
* If the calling thread and the thread that owns the window are attached to different input queues,
* the system posts the request to the thread that owns the window. This prevents the calling thread
* from blocking its execution while other threads process the request.
*
* FRAMECHANGED
* Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to the window,
* even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only
* when the window's size is being changed.
*
* NOCOPYBITS
* Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client
* area are saved and copied back into the client area after the window is sized or repositioned.
*
*/
NativeMethods.SetWindowPos(_hwnd, IntPtr.Zero, rcMonitorArea.Left, rcMonitorArea.Top, rcMonitorArea.Width, rcMonitorArea.Height, SWP.ASYNCWINDOWPOS | SWP.FRAMECHANGED | SWP.NOCOPYBITS);
}
}
handled = false;
return IntPtr.Zero;
} |
I cannot simulate it either this way. (Have 32-bit Win 10). Do you got the |
A full StackTrace would help telling you what causes the issue in your case. |
I would like to have full stacktrace, but we use CSharpAnalytics and it's bug 39 cuts the stacktrace. (We should switch to some other, maintained project.) Since the source code of MahApps and ControlzEx seems similar to me in the Now, it seems the bug is not exactly the same, so I will try to get more information about it. |
I've just got a stack trace from one user. I have updated the first post with this full stack trace. |
I guess, you don't know what the user did to cause the exception, right? |
I guess he closed a I have tried a few similar situations, but have no luck to get the exception. I have contacted the user to send OS and HW info and some more informations about the problem and will post here if he responds. |
2 users OS and HW:
Both users have just one screen, the problem has occurred when they have closed a maximized window by the mouse click on the From the errors in the Google Analytics I see the problem has started when we have switched MahApps 1.1.2 -> 1.3.0. May it be somehow connected, that we have the close |
I've probably found the problem. We have the window.WindowState = WindowState.Maximized;
window.IgnoreTaskbarOnMaximize = true;
window.IsWindowDraggable = false;
window.ShowTitleBar = false;
window.ShowCloseButton = false;
window.ShowMaxRestoreButton = false;
window.ShowMinButton = false; The user can switch off the fullscreen: window.IgnoreTaskbarOnMaximize = false;
window.IsWindowDraggable = true;
window.ShowTitleBar = true;
window.ShowCloseButton = true;
window.ShowMaxRestoreButton = true;
window.ShowMinButton = true; However, during this fullscreen switch off the window is first time a little bit smaller than maximized and in a moment it enlarges to the maximized size. A kind if a transition state. When the user clicks the close button in this transition state, then the exception occurs. |
I have reports of a bug in our app similar to ControlzEx/ControlzEx#13 :
@batzen May you write, please, how have you reproduced the bug for the ControlzEx? May the same fix be applied to the MahApps, too? Thanks.
Environment
The text was updated successfully, but these errors were encountered: