VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



The application checks the allocated logon time of the user at regular interval and automatically l

by Fazal Masud Kundi (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 19th February 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

The application checks the allocated logon time of the user at regular interval and automatically logoff the user account.

Rate The application checks the allocated logon time of the user at regular interval and automatically l



Dim no As Variant, userinfo As Variant
Dim start As Byte
Dim user As String, username As String
Dim st As Date, et As Date, ct As Date
Private Sub Form_Load()
start = 0
Set no = CreateObject("WScript.Network")
Open "c:\winnt\system32\repl\import\scripts\user.txt" For Input As #1
End Sub

Private Sub Timer1_Timer()
 If start = 0 Then
  Dim result As Long
  Dim textline As String
  user = no.username
  ct = Format(Time, "hh:mm AM/PM")
  username = ""
  Do While user <> username
   Line Input #1, textline
   username = Mid(textline, 1, InStr(textline, ",") - 1)
  Loop
  userinfo = Split(textline, ",")
  st = userinfo(1)
  et = userinfo(2)
  Set no = Nothing
  Close #1
  start = 1
 End If
 If ct < st Or ct > et Then
    result = ExitWindowsEx(EX_WIN, 0&)
 End If
End Sub
' file format
' user1,10:00 AM,12:00 PM
' user2,12:00 PM,01:00 PM

Download this snippet    Add to My Saved Code

The application checks the allocated logon time of the user at regular interval and automatically l Comments

No comments have been posted about The application checks the allocated logon time of the user at regular interval and automatically l. Why not be the first to post a comment about The application checks the allocated logon time of the user at regular interval and automatically l.

Post your comment

Subject:
Message:
0/1000 characters