扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
Option Explicit Const EWX_LOGOFF = 0 Const EWX_SHUTDOWN = 1 Const EWX_REBOOT = 2 Const EWX_FORCE = 4 Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long Private Sub fairyTimer_Timer() Dim myweekday, mydate Dim mytime, hh$, mm$, ss$ mydate = Date myweekday = Weekday(mydate) mytime = Time hh$ = Left$(mytime, 2) mm$ = Mid$(mytime, 4, 2) If myweekday > 1 And myweekday < 7 Then '周一至周五登录规则 If hh > 18 And hh < 19 Then Exit Sub Else End If Else '双休日登录规则 If hh > 13 And hh < 15 Then Exit Sub ElseIf hh > 18 And hh < 20 Then Exit Sub Else End If End If mainForm.Visible = True mainTimer.Interval = 60000 '启动注销进程 End Sub Private Sub Form_Load() Dim s$, cnt&, dl& cnt& = 199 s$ = String$(200, 0) dl& = GetUserName(s$, cnt) 'Debug.Print Left$(s$, cnt - 1); cnt If Left$(s$, cnt - 1) = "ChenHL" Then fairyTimer.Interval = 6000 '启动监听精灵 Else mainTimer.Interval = 0 End If End Sub Private Sub Form_Unload(Cancel As Integer) Dim ret& ret& = ExitWindowsEx(EWX_FORCE Or EWX_LOGOFF, 0) End Sub Private Sub mainTimer_Timer() Dim ret& ret& = ExitWindowsEx(EWX_FORCE Or EWX_LOGOFF, 0) End Sub |
|
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者