欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
VB6 制作簡(jiǎn)單的定時(shí)關(guān)機、重啟程序
******************************************
Shell "shutdown -s -t 30"
30秒自動(dòng)關(guān)機
取消關(guān)機:Shell "shutdown -a"
***************************************************

需要DTPicker控件 C:\WINDOWS\system32\MSCOMCT2.ocx
代碼如下:
    Option Explicit
    Private Const EWX_LogOff As Long = 0
    Private Const EWX_SHUTDOWN As Long = 1
    Private Const EWX_REBOOT As Long = 2
    Private Const EWX_FORCE As Long = 4
    Private Const EWX_POWEROFF As Long = 8
    
    'The ExitWindowsEx function either logs off, shuts down, orshuts
    'down and restarts the system.
    Private Declare Function ExitWindowsEx Lib "user32" _
    (ByVal dwOptions As Long, _
    ByVal dwReserved As Long) As Long
    
    'The GetLastError function returns the calling thread'slast-error
    'code value. The last-error code is maintained on a per-threadbasis.
    'Multiple threads do not overwrite each other's last-errorcode.
    Private Declare Function GetLastError Lib "kernel32" () AsLong
    
    Private Const mlngWindows95 = 0
    Private Const mlngWindowsNT = 1
    
    Public glngWhichWindows32 As Long
    
    'The GetVersion function returns the operating system in use.
    Private Declare Function GetVersion Lib "kernel32" () As Long
    
    Private Type LUID
    UsedPart As Long
    IgnoredForNowHigh32BitPart As Long
    End Type
    
    Private Type LUID_AND_ATTRIBUTES
    TheLuid As LUID
    Attributes As Long
    End Type
    
    Private Type TOKEN_PRIVILEGES
    PrivilegeCount As Long
    TheLuid As LUID
    Attributes As Long
    End Type
    
    'The GetCurrentProcess function returns a pseudohandle forthe
    'current process.
    Private Declare Function GetCurrentProcess Lib "kernel32" () AsLong
    
    'The OpenProcessToken function opens the access token associatedwith
    'a process.
    Private Declare Function OpenProcessToken Lib "advapi32" _
    (ByVal ProcessHandle As Long, _
    ByVal DesiredAccess As Long, _
    TokenHandle As Long) As Long
    
    'The LookupPrivilegeValue function retrieves the locallyunique
    'identifier (LUID) used on a specified system to locallyrepresent
    'the specified privilege name.
    Private Declare Function LookupPrivilegeValue Lib "advapi32"_
    Alias "LookupPrivilegeValueA" _
    (ByVal lpSystemName As String, _
    ByVal lpName As String, _
    lpLuid As LUID) As Long
    
    'The AdjustTokenPrivileges function enables or disablesprivileges
    'in the specified access token. Enabling or disablingprivileges
    'in an access token requires TOKEN_ADJUST_PRIVILEGES access.
    Private Declare Function AdjustTokenPrivileges Lib "advapi32"_
    (ByVal TokenHandle As Long, _
    ByVal DisableAllPrivileges As Long, _
    NewState As TOKEN_PRIVILEGES, _
    ByVal BufferLength As Long, _
    PreviousState As TOKEN_PRIVILEGES, _
    ReturnLength As Long) As Long
    
    Private Declare Sub SetLastError Lib "kernel32" _
    (ByVal dwErrCode As Long)
    
    Private Sub AdjustToken()
    
    '********************************************************************
    '* This procedure sets the proper privileges to allow a log off ora
    '* shut down to occur under Windows NT.
    '********************************************************************
    
    Const TOKEN_ADJUST_PRIVILEGES = &H20
    Const TOKEN_QUERY = &H8
    Const SE_PRIVILEGE_ENABLED = &H2
    
    Dim hdlProcessHandle As Long
    Dim hdlTokenHandle As Long
    Dim tmpLuid As LUID
    Dim tkp As TOKEN_PRIVILEGES
    Dim tkpNewButIgnored As TOKEN_PRIVILEGES
    Dim lBufferNeeded As Long
    
    'Set the error code of the last thread to zero using the
    'SetLast Error function. Do this so that the GetLastError
    'function does not return a value other than zero for no
    'apparent reason.
    SetLastError 0
    
    'Use the GetCurrentProcess function to set thehdlProcessHandle
    'variable.
    hdlProcessHandle = GetCurrentProcess()
    
    If GetLastError <> 0 Then
    MsgBox "GetCurrentProcess error==" & GetLastError
    End If
    
    OpenProcessToken hdlProcessHandle, _
    (TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY), hdlTokenHandle
    
    If GetLastError <> 0 Then
    MsgBox "OpenProcessToken error==" & GetLastError
    End If
    
    'Get the LUID for shutdown privilege
    LookupPrivilegeValue "", "SeShutdownPrivilege", tmpLuid
    
    If GetLastError <> 0 Then
    MsgBox "LookupPrivilegeValue error==" & GetLastError
    End If
    
    tkp.PrivilegeCount = 1 ' One privilege to set
    tkp.TheLuid = tmpLuid
    tkp.Attributes = SE_PRIVILEGE_ENABLED
    
    'Enable the shutdown privilege in the access token of thisprocess
    AdjustTokenPrivileges hdlTokenHandle, _
    False, _
    tkp, _
    Len(tkpNewButIgnored), _
    tkpNewButIgnored, _
    lBufferNeeded
    
    If GetLastError <> 0 Then
    MsgBox "AdjustTokenPrivileges error==" & GetLastError
    End If
    
    End Sub

Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
DTPicker1.CustomFormat = "HH:mm:ss"
DTPicker1.Format = dtpCustom
Label2.Caption = Date
End Sub

Private Sub Timer1_Timer()
Dim now_time
Dim END_TIME

now_time = Now
END_TIME = DTPicker1.Hour & ":" & DTPicker1.Minute &":" & DTPicker1.Second
Label2.Caption = "Now:" & now_time &"       " & "End Time:" & END_TIME

If Now >= DTPicker1.Value Then
'MsgBox "OO!"
AdjustToken
ExitWindowsEx (EWX_SHUTDOWN Or EWX_FORCE), &HFFFF
End If

End Sub
需要DTPicker控件 C:\WINDOWS\system32\MSCOMCT2.ocx
代碼如下:
    Option Explicit
    Private Const EWX_LogOff As Long = 0
    Private Const EWX_SHUTDOWN As Long = 1
    Private Const EWX_REBOOT As Long = 2
    Private Const EWX_FORCE As Long = 4
    Private Const EWX_POWEROFF As Long = 8
    
    'The ExitWindowsEx function either logs off, shuts down, orshuts
    'down and restarts the system.
    Private Declare Function ExitWindowsEx Lib "user32" _
    (ByVal dwOptions As Long, _
    ByVal dwReserved As Long) As Long
    
    'The GetLastError function returns the calling thread'slast-error
    'code value. The last-error code is maintained on a per-threadbasis.
    'Multiple threads do not overwrite each other's last-errorcode.
    Private Declare Function GetLastError Lib "kernel32" () AsLong
    
    Private Const mlngWindows95 = 0
    Private Const mlngWindowsNT = 1
    
    Public glngWhichWindows32 As Long
    
    'The GetVersion function returns the operating system in use.
    Private Declare Function GetVersion Lib "kernel32" () As Long
    
    Private Type LUID
    UsedPart As Long
    IgnoredForNowHigh32BitPart As Long
    End Type
    
    Private Type LUID_AND_ATTRIBUTES
    TheLuid As LUID
    Attributes As Long
    End Type
    
    Private Type TOKEN_PRIVILEGES
    PrivilegeCount As Long
    TheLuid As LUID
    Attributes As Long
    End Type
    
    'The GetCurrentProcess function returns a pseudohandle forthe
    'current process.
    Private Declare Function GetCurrentProcess Lib "kernel32" () AsLong
    
    'The OpenProcessToken function opens the access token associatedwith
    'a process.
    Private Declare Function OpenProcessToken Lib "advapi32" _
    (ByVal ProcessHandle As Long, _
    ByVal DesiredAccess As Long, _
    TokenHandle As Long) As Long
    
    'The LookupPrivilegeValue function retrieves the locallyunique
    'identifier (LUID) used on a specified system to locallyrepresent
    'the specified privilege name.
    Private Declare Function LookupPrivilegeValue Lib "advapi32"_
    Alias "LookupPrivilegeValueA" _
    (ByVal lpSystemName As String, _
    ByVal lpName As String, _
    lpLuid As LUID) As Long
    
    'The AdjustTokenPrivileges function enables or disablesprivileges
    'in the specified access token. Enabling or disablingprivileges
    'in an access token requires TOKEN_ADJUST_PRIVILEGES access.
    Private Declare Function AdjustTokenPrivileges Lib "advapi32"_
    (ByVal TokenHandle As Long, _
    ByVal DisableAllPrivileges As Long, _
    NewState As TOKEN_PRIVILEGES, _
    ByVal BufferLength As Long, _
    PreviousState As TOKEN_PRIVILEGES, _
    ReturnLength As Long) As Long
    
    Private Declare Sub SetLastError Lib "kernel32" _
    (ByVal dwErrCode As Long)
    
    Private Sub AdjustToken()
    
    '********************************************************************
    '* This procedure sets the proper privileges to allow a log off ora
    '* shut down to occur under Windows NT.
    '********************************************************************
    
    Const TOKEN_ADJUST_PRIVILEGES = &H20
    Const TOKEN_QUERY = &H8
    Const SE_PRIVILEGE_ENABLED = &H2
    
    Dim hdlProcessHandle As Long
    Dim hdlTokenHandle As Long
    Dim tmpLuid As LUID
    Dim tkp As TOKEN_PRIVILEGES
    Dim tkpNewButIgnored As TOKEN_PRIVILEGES
    Dim lBufferNeeded As Long
    
    'Set the error code of the last thread to zero using the
    'SetLast Error function. Do this so that the GetLastError
    'function does not return a value other than zero for no
    'apparent reason.
    SetLastError 0
    
    'Use the GetCurrentProcess function to set thehdlProcessHandle
    'variable.
    hdlProcessHandle = GetCurrentProcess()
    
    If GetLastError <> 0 Then
    MsgBox "GetCurrentProcess error==" & GetLastError
    End If
    
    OpenProcessToken hdlProcessHandle, _
    (TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY), hdlTokenHandle
    
    If GetLastError <> 0 Then
    MsgBox "OpenProcessToken error==" & GetLastError
    End If
    
    'Get the LUID for shutdown privilege
    LookupPrivilegeValue "", "SeShutdownPrivilege", tmpLuid
    
    If GetLastError <> 0 Then
    MsgBox "LookupPrivilegeValue error==" & GetLastError
    End If
    
    tkp.PrivilegeCount = 1 ' One privilege to set
    tkp.TheLuid = tmpLuid
    tkp.Attributes = SE_PRIVILEGE_ENABLED
    
    'Enable the shutdown privilege in the access token of thisprocess
    AdjustTokenPrivileges hdlTokenHandle, _
    False, _
    tkp, _
    Len(tkpNewButIgnored), _
    tkpNewButIgnored, _
    lBufferNeeded
    
    If GetLastError <> 0 Then
    MsgBox "AdjustTokenPrivileges error==" & GetLastError
    End If
    
    End Sub

Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
DTPicker1.CustomFormat = "HH:mm:ss"
DTPicker1.Format = dtpCustom
Label2.Caption = Date
End Sub

Private Sub Timer1_Timer()
Dim now_time
Dim END_TIME

now_time = Now
END_TIME = DTPicker1.Hour & ":" & DTPicker1.Minute &":" & DTPicker1.Second
Label2.Caption = "Now:" & now_time &"       " & "End Time:" & END_TIME

If Now >= DTPicker1.Value Then
'MsgBox "OO!"
AdjustToken
ExitWindowsEx (EWX_SHUTDOWN Or EWX_FORCE), &HFFFF
End If

End Sub

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Win2000/XP下屏蔽CTRL ALT DEL的一種方法 VB / API
VB實(shí)用代碼,收藏??!
VB或VBA代碼轉HTML的加載宏
標題欄
Visual Basic編程疑難問(wèn)題解
VB調用系統的"打印機設置"和"頁(yè)面設置".
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久