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


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

ExitWindowsEx 1
Restart Windows - now stuck 6
Logoff windows session from VBA 2
Exit Windows 8
Windows 10 shutdown black screen 13
ExitWindowsEx from service 4
Computer Crashing 8
Logging off 5

Back
Top