So I'm writing a personal program right now that basically I want it to help keep me from getting distracted when at school or work, essentially letting me only access the programs that I need when at those places.

My question is, whenever a program comes up in windows 7 that needs admin approval first, the request for approval comes up and locks out everything but that.
Would it be possible for me to do that with my program?
How would I access it?
If it can't be done in C++ but can be done in another language, what would it be?

noone will help you to do such a program because your purpose of using it is just stupid.
it's like you would want to keep yourself tied when you know how to escape

What windows is doing when that thing comes up is switching to another desktop. The "other" desktop is heavily secured so that it is very very difficult* for a program to be able to press the button for you (by moving the mouse pointer and clicking it from a malicious program).

* (but not impossible, nothing is truely impossible in a computer, because no software is completely perfect. Even if you did have perfect software, people aren't perfect, they leak passwords, etc)

I would not try to accomplish something like UAC. You could make it simpler and scan for "blacklisted" processes. In C# it's pretty easy to get the list of programs from WMI. You could enumerate win32_process instances and terminate blacklisted programs.

The problem is, you would simply kill the watchdog program, fire up your game and play it anyway. You would need to run your program as a service (to protect it from you disabling it from your limited account), and take away administrative privileges from yourself. You would need someone you trust to enforce your behavior who has admin privileges.

That's one approach anyway. Perhaps you could save the time you spend on this project and simply discipline yourself to work/study.

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.