-1

I'm writing a full-screen program for children (using C# and WinForms), and it is important that they (the users) are not able to move the mouse around and end up in another program in Windows or on the desktop -- in other words, once the teacher puts this program on the screen, the children must remain there, and the teacher can only exit the program using a password).

Is there any way to do this?

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
Jonathan Rachlin
  • 361
  • 3
  • 16
  • 6
    This mode of application is called 'kiosk mode'. That alone may help your googling. You want to intercept the keystrokes that cause window switching and prevent them. You also want a fullscreen size borderless window. – Gusdor Aug 20 '13 at 07:20
  • Your plan is flawed if they have access to the power button, you can handle the on closing method of the form – Sayse Aug 20 '13 at 07:20
  • With Windows 8 it's even more complex than before, because before if the user didn't have a keyboard but only a mouse, it was easy to stop him... Now with the "hot" corners it's more difficult. And stopping a user with a full keyboard was very very difficult – xanatos Aug 20 '13 at 07:22
  • Apparently, Windows 8.1 is introducing a kiosk mode which does this (but only for TIFKAM applications, not general WinForms) – Damien_The_Unbeliever Aug 20 '13 at 07:22
  • The most difficult thing is disable `Alt + TAB`, I think this can be disabled using hook but not easy. – King King Aug 20 '13 at 07:38

2 Answers2

1

You need to follow these steps

  1. Remove borders from your application

  2. Give a custom close button and On closing prompt for password

  3. intercept keyboard events so that user cannot switch to other window.

Ehsan
  • 31,833
  • 6
  • 56
  • 65
  • This is just about software, what about hardware? The OP should prepare some cap to cover the `Power` button so that the kids can't try holding down it. – King King Aug 20 '13 at 07:24
  • 2
    If they have access to the Hardware there is no point in doing this anyway ... – LunicLynx Aug 20 '13 at 07:25
  • the issue that OP wants to address is not the switching off the system rather he wants that nothing else is accessible. – Ehsan Aug 20 '13 at 07:27
  • "are not able to move the mouse around and end up in another program in Windows or on the desktop" is the problem statement – Ehsan Aug 20 '13 at 07:29
0

The only way i know of is if you handle all the default WindowMessages and supply an alternative behavior.

You probably have to change the MessageLoop for this:

Implementing a Win32 message loop and creating a Window object with P/Invoke

This might be a lot easier in another programming language, c++ for example.

Community
  • 1
  • 1
LunicLynx
  • 939
  • 1
  • 8
  • 16