am trying to write an application in c# to lock or freeze all programs until someone enters a value in the app's textbox and clicks 'ok'.

The purpose of the app would be to get people to enter their time(by force :) ).

As far as I know you can set it to top most but they can kill it with task manager so am stuck here....

I was thinking what is a better way of doing this.


Thanks

Set your window to full screen, always on top, then disable the Windows and Alt keys so that the user can't switch applications. This solution obviously involves some system hooking for true full screen and disabling special keys, but Google can help you with those problems.

I'm not sure it's possible to disable ctrl+alt+delete (not easily anyway). But you CAN disable task manager in user profiles (or just poll for taskman.exe and kill it). Also, killing explorer is an option as well - you can just relaunch it after the proper user entry. This way if they manage to get out of the app there's just a blank desktop to look at.

I have a library for some simple windows hooks written in C++/CLI that you can use in C#.

It's pretty app-specific (written for EasyScreenCLI) but I'm sure you can adapt it to your needs with minimal difficulty.

It has a mouse cursor hook too that gets the X/Y coordinates, somewhat fun to play with.

http://www.mediafire.com/?7iuwb3qakow1dqd

Of course I don't care what you do with the code, but don't blame me if it doesn't work right, y'know. Agree by downloading, etc. etc.

Also, to disable ctrl + alt + delete you can hook the ctrl and alt keys and prevent them from proceeding to the OS (as far as I know).
So you break the sequence and it only processes the "delete" key.
Can disable alt + tab in the same way, don't forget the left and right windows and alt keys though!

To use it you build the lib and add a reference to it in your C# app, the "dummyform" class is something that is invisible on windows aero enabled machines but is actually a foreground maximized window, sort of blocks clicking, but it's still just a form window.

If you don't have vs2010 and have vs2008 or something, try opening the .csproj file instead of the .sln (usually works for me).

great tips thanks guys :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.