Monday, August 1, 2011

How to lock Windows using Java Program

package com;

import java.io.IOException;

public class LockMachine {
 public static void main(String[] args) {
  String WINDOWS_LOCK_COMMAND="rundll32.exe user32.dll, LockWorkStation";
  Runtime rt = Runtime.getRuntime();

  try {
   rt.exec(WINDOWS_LOCK_COMMAND);

  } catch (IOException e1) {
   e1.printStackTrace();
  }
 }
}



2 comments:

Pavan said...

that was nice way to know how to interrupt using a Java program..

Pavan said...

it was nice new way to know how to interrupt using a Java program