Sections
|
|
|
| |
About Us
|
|
|
| |
Your Blog
|
|
You must be logged in and have permission to create or edit a blog.
|
|
Blog Roll
|
|
|
| |
|
|
|
Host your weblog here at WWWCoder.com for free. Just sign up for membership and you'll see a link on the left which will allow you to create your own weblog. We do ask that all blogs have a technical theme and be in English.
|
|
|
Location: Blogs Daffodilnet Express |
 |
| Posted by: Deepak Kumar Vasudevan |
10/15/2004 |
Quick Shortcut to Lock WorkstationWe normally use QuickLaunch bar in System Taskbar for almost any of our tasks. When we want go away from our system, we normally lock the workstation. Just a curious tip. A simple two three lines of code in C# can place a nice application whose shortcut can be placed in QuickLaunch bar to Lock the Workstation.
Console Version
using System; using System.Runtime.InteropServices; using System.Windows.Forms;
namespace QuickLock {
class MyComputerLock { [DllImport("user32.dll")] public static extern void LockWorkStation();
static void Main(String[] args) { try { LockWorkStation(); } catch (Exception ee) { MessageBox.Show(ee.Message); } } } }
Alternatively,if you put the code in Windows Form and you can customize the App.ICO to some friendly ICO file which will showup in QuickLaunch bar instead of the old rectangle which shows up for an EXE. |
|
| Permalink |
Trackback |
Comments (29)
Add Comment
|
re: Quick Shortcut to Lock Workstation |
By Anand on
8/28/2006 |
Try this for an easier method:
Create a shortcut on ur desktop with the following target:
rundll32 user32.dll,LockWorkStation
Voila... No need for exe (.Net or otherwise)
-Anand E
(anand_e@37.com) |
|
|
re: Quick Shortcut to Lock Workstation |
By Deepak Kumar Vasudevan on
8/28/2006 |
Yes!
|
|
|
re: Quick Shortcut to Lock Workstation |
By enff z nuff on
8/28/2006 |
you are all a bunch of lazy bastards
just hit window key + L
*shakes his head* |
|
|
re: Quick Shortcut to Lock Workstation |
By Muff on
8/28/2006 |
| Your shortcut "window key + L" works only in XP....! |
|
|
re: Quick Shortcut to Lock Workstation |
By haqpunk on
8/28/2006 |
| at my work we are distributing server deployed policies to all our workstations that don't allow users to lock their workstations so that multi user auto login workstations aren't being rendered useless to those that can't figure out how to put in the device id as their password to unlock, however some people that have their own workstations in their office have the same restrictive policies and can't lock their workstation (Win2k), so creating the server distributed shortcut appliction object that runs 'rundll32 user32.dll,LockWorkStation' was the perfect solution, thanks |
|
|
re: Quick Shortcut to Lock Workstation |
By R.Balaji on
8/28/2006 |
I found the article as well as the tip (rundll32 user32.dll,LockWorkStation ) as very useful.
Thanks. |
|
|
re: Quick Shortcut to Lock Workstation |
By Curious George on
8/28/2006 |
| Thanks a bunch Anand E. Your shortcut saved the day. Say, you got any other cool shortcuts like that? |
|
|
re: Quick Shortcut to Lock Workstation |
By Router on
8/28/2006 |
I have XP and normally use the Windows+L key to lock, but I found a need for the rundll32 option because I have 2 monitors for XP but I also have a KVM that switches my keyboard and one of the monitors to my linux box. In my case, I have a mouse each of the boxes (for personal reasons) so with that I can use the shortcut to lock the XP box with the mouse and not have to switch back with the KVM switch to use the keyboard.
Thanks for the tip!
Ken |
|
|
re: Quick Shortcut to Lock Workstation |
By jacinto on
8/28/2006 |
(not a different solution)
'VBScript.
Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
Set link = Shell.CreateShortcut(DesktopPath & "\Lock Workstation.lnk")
link.Description = "Lock Workstation"
link.HotKey = ""
link.IconLocation = "%SystemRoot%\system32\SHELL32.dll,47"
link.TargetPath = "%SystemRoot%\system32\rundll32.exe"
link.Arguments = "user32.dll, LockWorkStation"
link.WindowStyle = 3
link.WorkingDirectory = "c:\temp"
link.Save
|
|
|
re: Quick Shortcut to Lock Workstation |
By jacinto on
8/28/2006 |
| and save as *.vbs |
|
|
re: Quick Shortcut to Lock Workstation |
By Love Your Skills on
8/28/2006 |
| Thanks for This tip. I can ow use My ATI Remoter Wonder to Lock My Comp, Not just turn it off. |
|
|
re: Quick Shortcut to Lock Workstation |
By Ken on
8/28/2006 |
| I RDC to all my servers so hitting Windows + L is pointless, this is excellent! |
|
|
re: Quick Shortcut to Lock Workstation |
By Troy on
8/28/2006 |
| None of the above actions work on my system. My school has set the profile to prevent locking the workstation. This was a profile intended for the students, but was copied to the staff profile (the used the student profile as a template). The techies are not in any hurry to make the correction. Any thoughts on how to by-pass this? |
|
|
re: Quick Shortcut to Lock Workstation |
By Joel on
8/28/2006 |
| Nope. But if anyone knows, I'd sure like to know too since we have the same problem. (It's a pain in the a¤¤ not being able to lock the computers) |
|
|
re: Quick Shortcut to Lock Workstation |
By rao on
8/28/2006 |
| Is there any shortcut for unlock the workstatioon(2000) |
|
|
re: Quick Shortcut to Lock Workstation |
By Deepak Vasudevan on
8/28/2006 |
| VNC when running as service, we get the option 'Send CTRL+ALT+Del', You may like to check out that feature. |
|
|
re: Quick Shortcut to Lock Workstation |
By feigned on
8/28/2006 |
Awesome.
First hit on google using "lock workstation user32.dll" as search term.
Nice tip on Windows Key + L only working on XP, just tried it on a Windows 2000 Pro box and it does not work.
Thanks! |
|
|
re: Quick Shortcut to Lock Workstation |
By Mr Sensible on
8/28/2006 |
How about Ctrl-Alt-Delete, Enter ????????
Anyone tried that?! Beats vb scripts, .net apps....
|
|
|
re: Quick Shortcut to Lock Workstation |
By Tony on
8/28/2006 |
Sorry for the newbie question, but my programming experience is limited to perl and PHP.
I need an executable to lock an XP machine. Because of a program installed on the machine, I cannot use "rundll32 user32.dll,LockWorkStation". I would like to try the C# QuickLock program, but I have no idea how to compile it to an exe.
I have access to visual studio, but having never touched windows programming, I'm not sure what type of C# project this falls into, Console, Windows Application, etc... If I had the time, I'd love to learn C#, but I need to find a solution ASAP. If you could point me in the right direction, I'd be very appreciative. |
|
|
re: Quick Shortcut to Lock Workstation |
By Tony on
8/28/2006 |
| Nevermind... I got it working, but it isn't compatable. Thanks anyway. |
|
|
re: Quick Shortcut to Lock Workstation |
By Aaron on
8/28/2006 |
Another quick note on setting up a shortcut... once you do, you can then go into Properties of the shortcut and set the Shortcut key. I tried to set it (unsuccessfully) to the Window key and "L". It defaulted to Ctrl + Alt + L, which is just as good to me. Hope this helps.
Aaron |
|
|
re: Quick Shortcut to Lock Workstation |
By PuJo on
8/28/2006 |
Just tried it, with the"rundll32 user32.dll,LockWorkStation"
created the hot key, works like a champ. Using Win2k
Thanks for a great post |
|
|
re: Quick Shortcut to Lock Workstation |
By paul on
8/28/2006 |
| anyone who uses RDP to connect to a workstation can lock that remote workstation by pressing ctrl+alt+end. This makes the normal ctrl+alt+del window come up. You can choose the lock workstation option from there. Unless it's not available b/c of group policy. |
|
|
re: Quick Shortcut to Lock Workstation |
By ali on
8/28/2006 |
| I got the LOCK to work but how about the UNLOCKING part? Any ideas? |
|
|
|
re: Quick Shortcut to Lock Workstation |
By Klaus on
8/28/2006 |
I tried locking my PC using the rundll32...
but now i cannot unlock it.. I have memory loss on my password..help =( |
|
|
. |
By . on
8/28/2006 |
| It appears ASP.net is no match for these adbots. |
|
|
|
|
|
|
|
|
Blog Archive
|
|
|
|
Syndication
|
|
|
| |
|