1

I'm a french developer and I need to develop an Metro Style app for Windows 8 Pro who is always launched. I wanted to know how can I disable the close event of my app. My app need to be in front all the time and the user couldn't quit the app.

I thought I could disable all the shortcut with the GPO but the close gesture (drag the app from the top to the bottom) need to me disabled too.

I hope I was clear and everybody will understand the question :-). Feel free to ask me more specific questions.

Cordially Renaud.

toufensen
  • 33
  • 1
  • 7

2 Answers2

6

The short answer is: You can't.

The operating system and the user control the lifetime of Metro Style apps, you can't block the user from switching away from your app and once your app is no longer in the foreground, the application is suspended and the system can terminate the application at any moment.

Similarly, the user close gesture cannot be blocked.

Larry Osterman
  • 16,086
  • 32
  • 60
  • Yes, after spent some time to program on Windows 8, I read again my question and thought she was stupid. :D – toufensen Sep 26 '12 at 14:13
  • Actually it's not a stupid question. It's a question which is commonly asked. It's also a question that introduces a second question: "If there was a way of allowing an application to block the close gesture, could it be abused?" And once you think about the answer to *that* question, my answer makes more sense. – Larry Osterman Sep 26 '12 at 22:42
  • :-) Thank you. Well in the Close Threshold for Metro Apps [link](http://winaero.com/download.php?view.32) you'll notice that the application allowed to disable the close gesture. And to do that he sets the distance to close to 0 (when you drag the window to the bottom), so you can disabled the close gesture. After that you can disable all the shortcuts but indeed the application could be Suspended of course. – toufensen Sep 27 '12 at 08:43
  • And the application *will* be suspended 5 seconds after the user switches away from it. Once the app is suspended, it's subject to termination at any time without notice. You can also terminate apps from the recent apps list (right click on the app, select close). In general it's far better to work within the rules than to try to fight them. So implement an OnSuspending handler, an OnResume handler and accept that the user is in control of the app's lifetime. – Larry Osterman Sep 28 '12 at 02:34
3

In Windows 8.1 you may find Kiosk Mode to be what you need.

Jon B
  • 875
  • 7
  • 18