Restart the PC

  • Thread starter Thread starter Antares
  • Start date Start date
A

Antares

hi all,
is there in VS.NET a function allow to restart the
computer (similar at ExitWindowsEx API function)?

regards
 
Yes,


[DLLImport("AdvAPI32.DLL")]
public static extern Boolean InitiateSystemShutdownEx(
String lpMachineName,
String lpMessage,
Int32 dwTimeout,
Boolean bForceAppsCloesd,
Boolean bRebootAfterShutdown,
UInt32 dwReason);

then call it like InitiateSystemShutdownEx(mahineName, messagetosendtouser,
timeout, BooltoForceAppsClosed, boolToReboot,
IntValueOrEnumerationForReason)

Hope this helps.

Cheers,

Bill
 
it works,
thanks.

-----Original Message-----
Yes,


[DLLImport("AdvAPI32.DLL")]
public static extern Boolean InitiateSystemShutdownEx(
String lpMachineName,
String lpMessage,
Int32 dwTimeout,
Boolean bForceAppsCloesd,
Boolean bRebootAfterShutdown,
UInt32 dwReason);

then call it like InitiateSystemShutdownEx(mahineName, messagetosendtouser,
timeout, BooltoForceAppsClosed, boolToReboot,
IntValueOrEnumerationForReason)

Hope this helps.

Cheers,

Bill
Antares said:
hi all,
is there in VS.NET a function allow to restart the
computer (similar at ExitWindowsEx API function)?

regards


.
 
Just as an FYI, .NET Framework Solutions In Search of the Lost Wins32 API by
John Paul Mueller has a bunch of cool API examples. If you are accustomed
to making API calls, this book is a great resource.

Glad I could be of help.

Bill
Antares said:
it works,
thanks.

-----Original Message-----
Yes,


[DLLImport("AdvAPI32.DLL")]
public static extern Boolean InitiateSystemShutdownEx(
String lpMachineName,
String lpMessage,
Int32 dwTimeout,
Boolean bForceAppsCloesd,
Boolean bRebootAfterShutdown,
UInt32 dwReason);

then call it like InitiateSystemShutdownEx(mahineName, messagetosendtouser,
timeout, BooltoForceAppsClosed, boolToReboot,
IntValueOrEnumerationForReason)

Hope this helps.

Cheers,

Bill
Antares said:
hi all,
is there in VS.NET a function allow to restart the
computer (similar at ExitWindowsEx API function)?

regards


.
 
Back
Top