我用C#做一个关闭机子和重起机子的程序,代码如下:
问题是没有反应(是在window2000操作系统上)
不知道怎么回事。
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer    Const EWX_FORCE As Short = 4    Const EWX_LOGOFF As Short = 0    Const EWX_REBOOT As Short = 2    Const EWX_SHUTDOWN As Short = 1    Dim retval As Integer    ' 定义Esc按键    Const VK_ESCAPE As Short = &H1BS
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' 关闭计算机
        retval = ExitWindowsEx(EWX_SHUTDOWN, 0)    End Sub    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ' 重新启动        retval = ExitWindowsEx(EWX_REBOOT, 0)
    End Sub