• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling a *.exe in Java  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At the moment im making a password program which is used when your computer comes off "locked mode"(Win 2000).
The program is simply 3 tries and your out i have been able to run this part of the program fine. But i want to call the *.exe "C:\windows\system32\rundll32.exe user32.dll,LockWorkStation" which is the shortcut to locking the computer, so that when your 3 tries are up the computer goes back to lock mode.
How do i do this?
Any help will be appreciated.
Josh.
 
Josh Bryant
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ahh sorry the exe is "C:\WINNT\system32\rundll32.exe user32.dll,LockWorkStation"
 
Josh Bryant
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
****UPDATE****
Ok, I've done a bit of work on it and ill show my prog its primitive but i have only learnt java for 3 days so be nice..
import java.io.*;
class pas {
public static void main(String args[]) {

int y = 3, z = 3, a = 2, s =1 ;

System.out.print("Please enter the password:");
int x = EasyIn.readInt();

//----------------
if(x < 000 ) {
System.out.println("Computer Unlocked");}


if(x > 000){
y = z - 1; System.out.println("Computer Locked" );}

try {
Process q = Runtime.getRuntime().exec("C:/Program Files/Windows Media Player/wmplayer.exe");
q.waitFor();
}
//"C:/Program Files/Windows Media Player/wmplayer.exe"
catch(IOException e){}
catch(InterruptedException e){}
//C:WINNTsystem32rundll32.exe user32.dll,LockWorkStation
// cmd /c start rundll32.exe <user32.dll,LockWorkStation>
}
}
- Ignore my comments its just to keep the paths
As you can see when you lock/unlock it opens media player, its not supposed to do it when it unlocks but ill fix that. I can get media player working and going great, but when I try to put the "lock work station" in with the correct paths it doesnt work. It doesnt do anything how can i make this work?
Thanks,
Josh
 
Josh Bryant
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't worry about it boys fixed it all up
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!