With the help of VB.net how to lock a computer screen using a form

do anybody know please let me know

Recommended Answers

All 3 Replies

Process.Start("rundll32", "user32.dll,LockWorkStation")

@Reverend Jim: It won't be much of a lock if the user doesn't have a password setup.

@OP: Reverend Jim's solution is your best bet if you want to lock the OS and not just your app. You just have to make sure the current user has a password setup, or anybody can click on the icon and "unlock" the session.

If you don't go to the OS for the lock, then anybody can bypass it by using OS shortcuts like Alt+F4 or task manager or Windows logo + E/D/R or Alt + Tab or...

It won't be much of a lock if the user doesn't have a password setup.

That's pretty much a given. The question was how to lock the screen. Just locking the app doesn't accomplish that.

Come to think of it, there is one more possible. Before I retired I used to put an app called Transparant Screen Locker on all our servers. It would lock the console but leave the display visible. It was useful in that we could keep the servers secure and not have to unlock them to check status, etc. It is available (in a free version) at http://download.cnet.com/Transparent-Screen-Lock/3000-2092_4-10153460.html

There is a pro version at http://www.net-security.org/software.php?id=292 but I don't know how it differs from the free version.

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.