Re: ExitWindowsEx function not working.
- From: "Patrice" <scribe@xxxxxxxx>
- Date: Mon, 12 Jun 2006 18:15:33 +0200
Try perhaps :
http://support.microsoft.com/kb/168796/en-us
It could be that you need also some code to grant this privilege to the
process...
--
Patrice
"cj" <cj@xxxxxxxxxxxxx> a écrit dans le message de news:
%23SW%232cjjGHA.2200@xxxxxxxxxxxxxxxxxxxxxxx
I am an administrator if that matters. Also this does work.
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
'Shutdown
Dim t As Single
Dim WMIService, Computer As Object
WMIService =
GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
For Each Computer In
WMIService.InstancesOf("Win32_OperatingSystem")
t = Computer.Win32Shutdown(2 + 4, 0)
Next
End Sub
End Class
cj wrote:
Using VB2003 on Windows XP Pro
Why doesn't this work?
Public Class Form1
Inherits System.Windows.Forms.Form
Private Declare Auto Function ExitWindowsEx Lib "user32.dll" (ByVal
uFlags As Int32, ByVal dwreserved As Int32) As Int32
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim retval As Int32
retval = ExitWindowsEx(2 + 4, 0)
End Sub
End Class
.
- References:
- ExitWindowsEx function not working.
- From: cj
- Re: ExitWindowsEx function not working.
- From: cj
- ExitWindowsEx function not working.
- Prev by Date: Re: richtextbox changing fontstyles for selected text
- Next by Date: Re: line breaks
- Previous by thread: Re: ExitWindowsEx function not working.
- Next by thread: Re: ExitWindowsEx function not working.
- Index(es):