Click here to Skip to main content
15,880,972 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I need to write an app that prevents the user from using the computer if they don't accept the security agreement first. It's like an additional logon layer, from the user's point of view.

The Problem: The app runs after the user logs on, so I have to go full screen (easy) and prevent them from ALT-TABbing to anything else, opening the Task manager, using the Start key, etc.

And the app has to be self-contained, i.e. no extra DLLs, etc.

And work well in Windows 7 and well-enough in XP for those few folks who are stuck with it.

How should I do it?

1) Brute force ugly-but-easy-method: put in a timer that resets the focus to the Agree/Disagree buttons every 10th of a second so the user doesn't get a chance to do anything else?

2) Spend hours writing global hooks to eat any keystrokes or mouse clicks I don't want?

3) [some other way I can't think of]

Your opinion? (Or links to someone who has already done it so I can be lazy?)
Posted
Updated 24-Sep-12 9:15am
v2
Comments
Kenneth Haugland 24-Sep-12 15:03pm    
Write two separate dialogs, and if the user clicks cancel close the program, if the user clicks ok open the program?
GenJerDan 24-Sep-12 15:14pm    
I guess I explained it badly. It's to prevent users from the using the computer, not just an app. It's essentially an additional log on screen for the system. (I'll edit above to clairify.)
Sergey Alexandrovich Kryukov 24-Sep-12 16:22pm    
That is the critical point -- "the computer" which makes such behavior an outlaw. On could even sue your company for such things. And even it this happens inside your company, it could be classified as sabotage, seriously.
--SA
Sergey Alexandrovich Kryukov 24-Sep-12 16:21pm    
No matter how implemented, it will be the abuse, as OP is talking about "using the computer". The discussion of the goals of this is required.
Please see my answer.
--SA
GenJerDan 24-Sep-12 16:33pm    
Unless the user agrees to abide by the agreement, they ARE NOT ALLOWED to use the computer. If they don't like it, they can find another job somewhere else.

"Using a computer" is something not related to your application, but to the OS, a user session and authentication. If you want to prevent log in or force a person to log out, you need to do it on the OS level, through the log in / log out mechanism.

Preventing using a computer on the application level would be the abuse, not matter what you do. The mere fact that you want to restrict user's rights to use the user's own computer before login is a clear case of abuse anyway.

The reasonable user won't consider your company as a fair player and won't want to deal with your products. Try to draw your conclusion: who is the looser? :-)

Listen to the good friendly advice: don't do anything like that. Or explain your ultimate goals in detail to, before discussing the technical detail.

—SA
 
Share this answer
 
v4
Comments
fjdiewornncalwe 24-Sep-12 16:24pm    
+5. I totally agree.
Sergey Alexandrovich Kryukov 24-Sep-12 16:25pm    
Thank you, Marcus.
I knew you would understand this. :-)
--SA
GenJerDan 24-Sep-12 19:57pm    
Not the usrer's computer. They belong to the Federal government.
pasztorpisti 24-Sep-12 22:35pm    
First time I thought this is a joke but realized that it might have real basis. Still I write here my smiley that I wanted to put here racting to my first impression: :-)
Sergey Alexandrovich Kryukov 24-Sep-12 23:34pm    
Thank you for this comment. I'll comment the whole situation.

I don't think using the government property makes principal difference. I'll explain.

OK, the computer supplied by government and is used by government employees. And then, the dirty trick you would like to implement sabotages the work of those government employees, no less. And if the government employs some workers, it is supposed to provide reasonable working conditions adequate to their responsibilities, and this is really required to be on safe side. If the user is required to accept a security requirements formally, and really no work is allowed before that, it should be on the logon stage; no way it could be done after such highly controlled user is already logged on.

I do think the problem is artificial though. Be requiring that weird thing OP calls "after the user logs on", OP tries to simplify his task. Not so fast. The serious security measures require serious approach and appropriate technology. OP just need to do a lot more work a lot more seriously and, as a minimum, investigate how to hook into the log in procedure.

By the way, I don't know what kind of "KGB" is upholding the security in OP's organization, but I would be very careful with a developer who takes the freedom of asking such question at CodeProject forum. No, real professional dealing with security don't do it, if it is related to such work. Potentially, it could be already considered as a leak of sensitive information. :-)

--SA
I'm using the global hooks method to capture all keystrokes so the user can't get to anything else on the system as long as the app is running.
The only way they could bypass it would be to ctrl-alt-delete to get to the Task Manager...which is not available to them because of a GPO.
 
Share this answer
 
Comments
fjdiewornncalwe 26-Sep-12 9:56am    
I'll give you a +5 for finding a solution to your issue and sharing it. I am a little skeptical if perhaps there was a more creative way to provide this functionality. I certainly don't have a better suggestion, but somehow a brute force approach like this always makes me cautious.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900