VB.Net遠(yuǎn)程控制編程實(shí)例[注銷關(guān)機(jī)重啟] |
作者:IVA 來(lái)源:樂(lè)博網(wǎng)轉(zhuǎn)化 更新時(shí)間:2007-12-16 |
原代碼為C#編寫,由L3'Studio團(tuán)隊(duì)開(kāi)發(fā);樂(lè)博網(wǎng)將其轉(zhuǎn)化為VB.Net代碼 功能描述:管理類(主要有關(guān)機(jī)重啟等功能,API函數(shù)實(shí)現(xiàn)) 相關(guān)事件 :注銷 關(guān)機(jī) 重啟 命名空間:Lob.Windows 子類:WindowsManager 轉(zhuǎn)化后代碼如下: Public Class WindowsManager Friend Const SE_PRIVILEGE_ENABLED As Integer = 2 Friend Const TOKEN_QUERY As Integer = 8 Friend Const TOKEN_ADJUST_PRIVILEGES As Integer = 32 Friend Const SE_SHUTDOWN_NAME As String = "SeShutdownPrivilege" Friend Const EWX_LOGOFF As Integer = 0 Friend Const EWX_SHUTDOWN As Integer = 1 Friend Const EWX_REBOOT As Integer = 2 Friend Const EWX_FORCE As Integer = 4 Friend Const EWX_POWEROFF As Integer = 8 Friend Const EWX_FORCEIFHUNG As Integer = 16 Friend Declare Function GetCurrentProcess Lib "kernel32.dll" () As IntPtr Friend Declare Function OpenProcessToken Lib "advapi32.dll" (ByVal h As IntPtr, ByVal acc As Integer, ByRef phtok As IntPtr) As Boolean Friend Declare Function LookupPrivilegeValue Lib "advapi32.dll" (ByVal host As String, ByVal name As String, ByRef pluid As Long) As Boolean Friend Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal htok As IntPtr, ByVal disall As Boolean, ByRef newst As TokPriv1Luid, ByVal len As Integer, ByVal prev As IntPtr, ByVal relen As IntPtr) As Boolean Friend Declare Function ExitWindowsEx Lib "user32.dll" (ByVal flg As Integer, ByVal rea As Integer) As Boolean Private Shared Sub DoExitWin(ByVal flg As Integer) Public Shared Sub ShutDown() Public Shared Sub Reboot() <StructLayout(LayoutKind.Sequential, Pack:=1)> _ Public Count As Integer Public Luid As Long Public Attr As Integer
|
聯(lián)系客服