Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi! First sorry for my english, i'm italian..i hope you understand :)

 

I saw a thread about the use of "ExitWindowsEx" function in VB.NET. I need more informations about this function (or another similar one), because i have to write a vb.net application that is able to shutdown a pc with Windows 98 SE.

How could i do it?

 

Have you got an example code to close all processes and shutdown PC ?

Thank you very much.

 

Mark

  • *Experts*
Posted

For Win98 this should do it:

Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer
'constant names speak for themselves : )
Const EWX_LOGOFF = 0 
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
'then in some sub or function
ExitWindowsEx(EWX_REBOOT, 0) 'or whichever you want to do

Note that this will not work on Win2000 and NT type of OSs.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...