wood burning stoves 2.0*
The moose likes Java in General and the fly likes Windows 2000 Plateform... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Windows 2000 Plateform..." Watch "Windows 2000 Plateform..." New topic
Author

Windows 2000 Plateform...

Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
Hi all,

Can anyone please explain how to shutdown windows 2000 using java program. Well on MSDN I found one method which can shutdown windows.

DWORD WINAPI InitiateShutdown(
LPTSTR lpMachineName,
LPTSTR lpMessage ,
DWORD dwGracePeriod,
DWORD dwShutdownFlags,
DWORD dwReason
);

Is there any dll file available for this. I found one dll file csWindowsShutdown.dll. When I load this dll, then runtime system throws an Error says mscoree.dll not found.

Is there any alternate way of doing this?

Thanks & Regards

Naseem


Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41633
    
  55
Windows has a SHUTDOWN command, which you can execute using Runtime.exec.


Ping & DNS - my free Android networking tools app
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
Thanks Ulf...

It worked as you have explained.



java Shutdown shutdown /L /T:10

This shutdown my computer in 10 seconds.

Thanks once again


Regards


Naseem
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14117
    
  16

If you look at the description in the Windows API reference on MSDN, it tells you in which DLL this function is: advapi32.dll.

Note that the description also says Requires Windows Vista / Requires Windows Server "Longhorn", so this is most likely not going to work on Windows 2000 anyway. You should use the function ExitWindowsEx instead.

See also: Shutting Down on MSDN.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Windows 2000 Plateform...