Results 1 to 4 of 4

Thread: Locking system Date/Time

  1. #1
    kansevijaya
    Guest

    Unhappy Locking system Date/Time

    How can I lock my system's Date/Time to be modified or can I give password for modification of system Date/Time.
    Another is how can I access systems uptime from VB application?

  2. #2
    Addicted Member
    Join Date
    Jul 2001
    Posts
    133
    Your first question, "How can I lock my system's Date/Time" is tricky. I haven't seen anything on that - any program can call the Windows API at any time to change these things. However, one way is to run a background program that regularily checks the date/time - if it is out TOO much from when it was last checked - change it back. :-)

    Your second question, "how can I access systems uptime from VB application", is a Windows API called GetTickCount (retrieves the number of milliseconds that have elapsed since the system was started).

  3. #3
    TheSarlacc
    Guest
    maybe u wouldnt need a API call for that. maybe something like this:

    Dim sTime as String, sDate as String

    Private Sub cmdLock_Click()
    sTime = Time
    sDate = Date
    tmrReset.Interval = 1000
    End Sub

    Private Sub tmrReset_Timer()
    Time = sTime
    Date = sDate
    End Sub

    Private Sub cmdUnlock_Click()
    tmrReset.Interval = 0
    End Sub

    This way, even if the clock and/or date is changed by another program, then it will be reset to the time when the Lock button was pressed!!!
    and for more protection, just decrease the tmrReset.Interval value!!

  4. #4
    Addicted Member
    Join Date
    Jul 2001
    Posts
    133
    That was not what he was trying to accomplish.

    One question was how to stop other programs from changing the date time. You don't simply want to set it back. You have to monitor it - know what it should be ... when it changes TOO MUCH (ie someone has changed it) you want to set it to what it would have been.

    Another, he wanted the time since the system started. You could write a program that starts with Windows (WHY-waste resources) or simply use the GetTickCount API.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width