Any Xojo compiled windows application that receives a WM_QUERYENDSESSION event from the OS (Windows 10 in my case) causes the failed assertion “Framework failed assertion at runtimemainloop.cpp:629” . WM_QUERYENDSESSION can be generated from a number of sources, including logoff/shutdown while the application is running.
I’ve tested this with several VM’s (8.0, 8.1, 7.0) and I still get the the same assertion.
You can recreate this issue (if you have MBS plugins) using the following code in a button even handler:
const WM_QUERYENDSESSION = &h0011
Dim hndl as Integer = Val("&h"+txtWinHandleHex.Text)
Call RemoteControlMBS.WinSendMessage(hndl,WM_QUERYENDSESSION,1,0)
txtWInHandleText is the hex window handle captured using a utility like spy++
I’m using Xojo 2015r2.4, and I haven’t tested previous versions of Xojo.
Any Xojo compiled windows application that receives a WM_QUERYENDSESSION event from the OS (Windows 10 in my case) causes the failed assertion “Framework failed assertion at runtimemainloop.cpp:629” . WM_QUERYENDSESSION can be generated from a number of sources, including logoff/shutdown while the application is running.
I’ve tested this with several VM’s (8.0, 8.1, 7.0) and I still get the the same assertion.
You can recreate this issue (if you have MBS plugins) using the following code in a button even handler:
const WM_QUERYENDSESSION = &h0011
Dim hndl as Integer = Val("&h"+txtWinHandleHex.Text)
Call RemoteControlMBS.WinSendMessage(hndl,WM_QUERYENDSESSION,1,0)
txtWInHandleText is the hex window handle captured using a utility like spy++
I’m using Xojo 2015r2.4, and I haven’t tested previous versions of Xojo.
Anyone else experiencing this issue?[/quote]
Please file a bug report in Feedback with steps to reproduce.
[quote=216015:@Jim Cramer]And it’s pretty easy to trap that message and foreword/translate to WM_CLOSE however you can’t expect that all Xojo users will know how to do that.
Crashing when the operating system sends a signal to all applications that it is shutting down is a very serious issue that needs to be addressed…[/quote]
Absolutely, Xojo needs to fix the bug. However, for those of us who are shipping Windows 10 apps now and can’t wait for a new IDE release, having a workaround that we can use now would be ideal.
I don’t think it’s just a Windows 10 issue as I’ve been able to reproduce on Win 7/8 as well. Anywho, the workaround is something like this:
In your Window open event:
#If TargetWin32
Declare Function SetWindowLongW Lib "user32" ( hwnd As Integer, nIndex As Int32, dwNewLong As Ptr ) As Ptr
Const GWL_WNDPROC = -4
theOldWndProc = SetWindowLongW( Me.Handle, GWL_WNDPROC, AddressOf theNewWndProc )
#endif
Then create a new Shared Method on your window like this (NOTE: Don’t try to capture messages in this callback with something like System.DebugLog, bad things will happen!)
Shared Function theNewWndProc(hWnd as Integer, msg as Integer, wParam as Integer, lParam as Integer) As Integer
#If TargetWin32
#pragma X86CallingConvention StdCall
const WM_QUERYENDSESSION = &h0011
If msg = WM_QUERYENDSESSION Then
Quit
End If
Declare Function CallWindowProcW Lib "User32" ( oldProc As Ptr, handle As Integer, msg As Integer, wParam As Integer, lParam As Integer ) As Integer
Return CallWindowProcW( theOldWndProc, hWnd, msg, wParam, lParam )
#endif
End Function
Don’t forget to add the shared property to your window as well: