If you mean to shutdown the local machine or Remote machine, have a look at the WMI interfaces in the system.management classes.
Hi, Royce
You have to use ExitWindowsEx API and here is example, which I use with
EWX_SHUTDOWN
[DllImport("user32.dll", ExactSpelling=true, SetLastError=true) ]
internal static extern bool ExitWindowsEx( int flag, int reason );
public const int EWX_LOGOFF = 0x00000000;
public const int EWX_SHUTDOWN = 0x00000001;
public const int EWX_REBOOT = 0x00000002;
public const int EWX_FORCE = 0x00000004;
public const int EWX_POWEROFF = 0x00000008;
public const int EWX_FORCEIFHUNG = 0x00000010;
{
flg=EWX_SHUTDOWN;
ExitWindowsEx( flg, 0 );
}
HTH
Alex
> Hi,
>
[quoted text clipped - 3 lines]
> TIA,
> Royce
Gabriele G. Ponti - 17 May 2004 13:11 GMT
This is not going to work properly on NT/2000/XP as they require the
application to have a specific privilege.
http://www.dotnet247.com/247reference/msgs/3/17306.aspx