I'm trying to prevent the app from being closed by clicking the Close box on the App Window. For example, having a text editor with unsaved changes, upon pressing Close Box, I would first display, "Do you want to save changes before exiting?"
How can I detect app wanting to close and prevent that from happening?
I'm using C++, and this needs to be for Windows 10 Universal Apps UWP. I already know how to do this for Win32.
So disable individually or via the top-most toggle - to OFF. Again, that is: Settings -> Privacy -> Background Apps then toggle to OFF for specific apps or turn "Let Apps run in the background" to OFF.
To do this, press the Start button and go to Settings -> Apps -> Apps and features. In the list of apps, select the app to be uninstalled. Click the Uninstall button. This will only uninstall the UWP app in the current user's profile.
So here's the big reveal: you can easily full screen almost any UWP apps in Windows 10 just by hitting `Shift + Win + Enter` after focusing a UWP app. The shortcut should work with most UWP apps in Windows 10, but it may not work if an app doesn't allow the window to be maximized in the first place.
UWP is one choice for creating apps that run on Windows 10 and Windows 11 devices, and can be combined with other platforms. UWP apps can make use of Win32 APIs and .
The comments are correct. There is currently no way for a regular Store app to do this.
However, with the Creators Update (and corresponding SDK) we have included a preview API that you can now check out for this functionality:
The Windows.UI.Core.Preview.SystemNavigationManagerPreview class provides a CloseRequested event that an app can mark as handled. For the event to work the app will need to declare the restricted 'confirmAppClose' capability per: https://docs.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations
Please let us know your feedback.
Thanks, Stefan Wick - Windows Developer Platform
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With