• 您的位置我爱Aspx >> VB.Net >> VB.NET中实现关机/休眠/重启/注销的类
  • VB.NET中实现关机/休眠/重启/注销的类

  • 作者:aspxer  来源:internet  日期:2007-5-20 14:01:16  关键字:.net
  • If (LookupPrivilegeValue("", privilege, privilegeLUID)) = 0 Then Throw New PrivilegeException(FormatError(Marshal.GetLastWin32Error()))

    tokenPrivileges.PrivilegeCount = 1

    tokenPrivileges.Privileges.Attributes = SE_PRIVILEGE_ENABLED

    tokenPrivileges.Privileges.pLuid = privilegeLUID

    Dim Size As Integer = 4

    If (AdjustTokenPrivileges(tokenHandle, 0, tokenPrivileges, 4 + (12 * tokenPrivileges.PrivilegeCount), newPrivileges, Size)) = 0 Then Throw New PrivilegeException(FormatError(Marshal.GetLastWin32Error()))

    End Sub

    Protected Sub SuspendSystem(ByVal hibernate As Boolean, ByVal force As Boolean)

    If Not CheckEntryPoint("powrprof.dll", "SetSuspendState") Then Throw New PlatformNotSupportedException("The SetSuspendState method is not supported on this system!")

    SetSuspendState(Convert.ToInt32(IIf(hibernate, 1, 0)), Convert.ToInt32(IIf(force, 1, 0)), 0)

    我对这篇文章有话说?
  • 广告位招租,广告代号:content_468_15
  • 上一篇:消息队列在VB.NET数据库开发中的应用
    下一篇:VB.NET实现五子棋的人工智能(1)