[HELP]Time Limiter

Posts 115 of 17 · Page 1 of 2
[HELP]Time Limiter
Hello, can someone teach me or gimme a code for a time limiter?

I want my program just to be used 2 hours everyday, and it will reset every 6am... And i want it to be saved in the registry so that it cant be hackable be changing the pc time

Thanks!
ill see what i can find
i found this on utube once
[php]Sleep(6000)[/php]?
Quote Originally Posted by Devient_ View Post
ill see what i can find
i found this on utube once
[php]Sleep(6000)[/php]?
do you have any idea about what you wrote?
Quote Originally Posted by Devient_ View Post
ill see what i can find
i found this on utube once
[php]Sleep(6000)[/php]?
that is a C++ function. what that means is that the CPU or the Application will Pause.. are Stop for 6 secs = 6000.

it is what we use in Thread of our hacks.. U kno u cant be all work and no rest. u will get tired and lag
Quote Originally Posted by topblast View Post


that is a C++ function. what that means is that the CPU or the Application will Pause.. are Stop for 6 secs = 6000.

it is what we use in Thread of our hacks.. U kno u cant be all work and no rest. u will get tired and lag
Not only C++.

System.Threading.Thread.Sleep(timeinms)

Anyways, that's not what he wants.


@OP

You should play around with DateTime.Now.ToShortTimeString in a timer.
Simply have a timer which decrease incraments by second when the application is running, if application reaches 0 (so 2 hours is 120 minutes, there are sixty seconds in a minute, thats 3600 seconds in an hour so 2 hours in seconds would be 7200 seconds)

So set timer to 1000 ms add a label, and decrease in 1 second incraments if application reaches 0 end , etc. etc.

to avoid users changing time, use atomic time. Grab the time off the internet instead, as in from a specific url , You can use the "World Time API" to accomplish this, then there is no need to worry about registry modifications/additions.

does all this make sense, or do I have to write the code

This basic codes can be helpful to him..
but definitely opposite from NextGen1 [this is increment]

Required

2 labels
[Visible = False]
[Text = 0]

1 Timer
[Enabled = True]
[Interval = 1000]

2 Labels are named as
Seconds
Minutes

1 timer can be named in anything you want

Then this code will be putted in timer.tick

Code:
Seconds.Text = Seconds.Text + 1

If Seconds.Text = 60 Then
    Seconds.Text = 0
    Minutes.Text = Minutes.Text + 1
End If

'Then this will be the code if the elapsed time is 2 hours.
If Seconds.Text = 0 and Minutes.Text = 120 Then
    Timer1.Enabled = False
    'Put Any codes here when the the it is already 2 hours.
End If
Quote Originally Posted by nathanael890 View Post

This basic codes can be helpful to him..
but definitely opposite from NextGen1 [this is increment]

Required

2 labels
[Visible = False]
[Text = 0]

1 Timer
[Enabled = True]
[Interval = 1000]

2 Labels are named as
Seconds
Minutes

1 timer can be named in anything you want

Then this code will be putted in timer.tick

Code:
Seconds.Text = Seconds.Text + 1

If Seconds.Text = 60 Then
    Seconds.Text = 0
    Minutes.Text = Minutes.Text + 1
End If

'Then this will be the code if the elapsed time is 2 hours.
If Seconds.Text = 0 and Minutes.Text = 120 Then
    Timer1.Enabled = False
    'Put Any codes here when the the it is already 2 hours.
End If
Stopwatch is much simpler.

Form_Load event:
[php]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CheckForIllegalCrossThreadCalls = False
Dim tThread As New Threading.Thread(AddressOf addTime)
tThread.Priority = Threading.ThreadPriority.AboveNormal
tThread.Start()
End Sub
[/php]

[php]
Private Sub addTime()
Dim sWatch As New Stopwatch
sWatch.Reset()
sWatch.Start()
Do Until sWatch.Elapsed.Hours = 2
Threading.Thread.Sleep(1000)
Loop
Application.Exit
End Sub
[/php]
shove a timer there

every 10 seconds update the registry value by 10.
if registry value = 180 then
end
end if

there we go
@J-Deezy
Does it save its setting? Since I want my trainer to be STRICTLY available for 2hours each day.

And if they used the trainer and close it, the time will still continue, and 5mins before 2hrs a msgbox will appear, and in 2hrs, if they are still using it, it will be forced closed

I know it hard---
Quote Originally Posted by .Celtics View Post
@J-Deezy
Does it save its setting? Since I want my trainer to be STRICTLY available for 2hours each day.

And if they used the trainer and close it, the time will still continue, and 5mins before 2hrs a msgbox will appear, and in 2hrs, if they are still using it, it will be forced closed

I know it hard---
Nah it's not hard, you can use my.Settings to save the hours & ":" & minutes & ":" & seconds and then just some simple calculations to work out time left when they next reload.
If it okay with you...
Can you make an open source and upload it...
Quote Originally Posted by .Celtics View Post
If it okay with you...
Can you make an open source and upload it...
Put some effort on it and tell us what was going wrong... you will never learn just by coping and pasting an "open source"...

I bet you did not even tried.. And that's wrong man.
Yeah I will help you out man, but I'm not going to go to the trouble of actually creating a project, uploading and getting scans just for this, try it out a bit, it's just a bit of logic and basic stuff to get it going. If you still have problems tell me where and what and I will try assist you.
Anyway will work. There is 1000 different ways to accomplish the task (or any task for that matter) I just think a atomic API is a effective way to prevent modification / patching
Posts 115 of 17 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?