Floating tool windows prevent Windows logoff/shutdown

Docking/MDI for Windows Forms Forum

Posted 10 years ago by Tom Johnson
Version: 14.1.0320
Platform: .NET 4.5
Environment: Windows 7 (64-bit)
Avatar

I've set ToolWindowsCanClose to false in the doc manager.   If I have any floating tool windows, Windows will give the message that my program is preventing the shutdown/logoff.   From what I can tell my main form does not even get the form closing event.   Any suggestions?

Comments (5)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Tom,

That's a difficult issue.  In the OnClosing method of the Form that hosts the floating tool windows, we do a check to see if all tool windows allow closing.  If not, we set e.Cancel = true.  We have to do this otherwise clicking the X button would allow the tool windows to close, when the developer (you) specifically didn't want them to.  I don't really see a way to detect if the close request is because of an app shutdown.

If you are able to detect that it's because of an app shutdown somehow, you could reset that flag so that closing is allowed and then things should close properly.


Actipro Software Support

Posted 10 years ago by Tom Johnson
Avatar

It is strange because the app will close just fine if the user closes the main form using the 'x' button.   But, when a logoff/shutdown occurs, Windows pauses for a few seconds and then reports my app prevents it to close.   It seems like it is sending a different message rather than attempting to close the windows.

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

This MSDN article gives some info on how Windows shutdown works and might be useful in determining which extra Windows messages to watch for from your main app:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa373651(v=vs.85).aspx


Actipro Software Support

Posted 10 years ago by Tom Johnson
Avatar

Odd, when I have a floating window neither the floating window or the main form's WndProc receive a WM_QUERYENDSESSION, but if I don't have a floating window the main form receives a WM_QUERYENDESSION and continues to terminate as expected.

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

I wonder if they do the fallback where they just send WM_CLOSE messages if there are owned windows (like the floating windows) in the app.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.