其中关屏是用hesicong的代码,具体看http://blog.csdn.net/hesicong/archive/2005/03/18/323310.aspx
硬复位是blaze的 贼狠的招数~改成vb.net的~具体看http://www.cnblogs.com/blaze/archive/2004/10/03/48732.html
Public Class Power
Private Const SETPOWERMANAGEMENT As Int32 = 6147
Declare Function ExtEscapeSet Lib "coredll" Alias "ExtEscape" (ByVal hdc As IntPtr, ByVal nEscape As Int32, ByVal cbInput As Int32, ByVal plszInData As Byte(), ByVal cbOutput As Int32, ByVal lpszOutData As IntPtr) As Int32
Declare Function GetDC Lib "coredll" (ByVal hwnd As IntPtr) As IntPtr
Declare Function KernelIoControl Lib "coredll" (ByVal dwIoControlCode As Integer, ByVal lpInBuf As IntPtr, ByVal nInBufSize As Integer, ByVal lpOutBuf As IntPtr, ByVal nOutBufSize As Integer, ByRef lpBytesReturned As Integer) As Integer
Declare Sub SetCleanRebootFlag Lib "coredll" ()
Declare Sub keybd_event Lib "coredll" (ByVal bVK As Byte, ByVal bScan As Byte, ByVal dwFlags As Byte, ByVal dwExtraInfo As Byte)
Public Enum VideoPowerState As Integer
VideoPowerOn = 1
VideoPowerStandBy
VideoPowerSuspend
VideoPowerOff
End Enum
Public Shared Sub ScreenPowerOff()
Dim hdc As IntPtr = GetDC(IntPtr.Zero)
Dim vpm() As Byte = {12, 0, 0, 0, 1, 0, 0, 0, VideoPowerState.VideoPowerOff, 0, 0, 0, 0}
ExtEscapeSet(hdc, SETPOWERMANAGEMENT, 12, vpm, 0, IntPtr.Zero)
End Sub
Public Shared Sub ScreenPowerOn()
Dim hdc As IntPtr = GetDC(IntPtr.Zero)
Dim vpm() As Byte = {12, 0, 0, 0, 1, 0, 0, 0, VideoPowerState.VideoPowerOn, 0, 0, 0, 0}
ExtEscapeSet(hdc, SETPOWERMANAGEMENT, 12, vpm, 0, IntPtr.Zero)
End Sub
Public Shared Sub HardReset()
Dim IOCTL_HAL_REBOOT As Integer = &H101003C
Dim bytesReturned As Integer = 0
SetCleanRebootFlag()
KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, bytesReturned)
End Sub
Public Shared Sub SoftReset()
Dim IOCTL_HAL_REBOOT As Integer = &H101003C
Dim bytesReturned As Integer = 0
KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, bytesReturned)
End Sub
Public Shared Sub PowerOff()
Dim VK_OFF As Byte = &HDF
Dim KEYEVENTF_SILENT As Byte = &H4
Dim KEYEVENTF_KEYUP As Byte = &H2
keybd_event(VK_OFF, 0, KEYEVENTF_SILENT, 0)
keybd_event(VK_OFF, 0, KEYEVENTF_SILENT Or KEYEVENTF_KEYUP, 0)
End Sub
End Class
硬复位是blaze的 贼狠的招数~改成vb.net的~具体看http://www.cnblogs.com/blaze/archive/2004/10/03/48732.html
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)