I am making an auto-clicking program, and there are currently 5 different time settings.
Hours, Minutes, Seconds, 1/10 of a Second, and 1/10 of a Second.
I have some uses for this program that require IMEADIATE clicking, as in 1/1000 or 1/10 000 of a second. I have knoticed that on the timer interval, there is not much differance between 1 and 10... I tested this out on labels. Is there any files that i can include or any code i could use to achieve these faster times?
(I would use Form_Load, but i need to have it in an area where i can controll it.)
Sorry, im not a huge expert in visual basic. I understand those are Modules, but i could use more explination on what they actchually do. and is there anyway that i could get something like a DLL to calculate faster speed? or something?
You won't need to. The Query API's are 1 millisecond accurate. The timeGetTime and GetTickCount API's are about 15 milliseconds accurate. The Timer on the other hand is completely software, so there is no accuracy, and it depends how fast your computer is. It's slow, sluggish, inaccurate, inconsistant, and gets worse the more you run simutaniously because the others need to fire off one by one before the next timer can fire.
However, you can make the timeGetTime API be 1 ms accurate by setting both of these to 1:
VB Code:
Public Declare Function timeBeginPeriod Lib "winmm.dll" (ByVal uPeriod As Long) As Long
Public Declare Function timeEndPeriod Lib "winmm.dll" (ByVal uPeriod As Long) As Long
Ok, ive been fooling around with your timer code, and i cannot quite seem to get it to work... Ive uploaded what i basically would like the speeds to be
(There are minutes and hours, but i dont expect anyone to spend an hour watching a form -.-)
I also dont know how to call this as a you would a timer... like for a timer you go
VB Code:
private sub timer1_timer()
'Your cude is processed for every interval
end sub
how am i going to do this for your code?
VB Code:
private sub seconds()
msgbox "Look at me, im so annoying, i appear every second :D"
And on top of that, the Cls function was making your labels crazy!
Heres your solution. Your big problem is the fact that you were checking if they were equal to a certain time. Well you kinda forgot its time you were working with cause the numbers are gonna go higher than that. Mod operator to the rescue! Note that the Mod operator doesn't work with decimals, so I created one that does called Modulus:
VB Code:
Option Explicit
Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As Currency) As Long
Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpCount As Currency) As Long
Private Tick_Count As Currency
Private Start_Time As Currency
Private End_Time As Currency
Private Delta_Time As Currency
Private Str As String
Private Seconds As Long
Private Function Modulus(ByVal Value1 As Double, ByVal Value2 As Double) As Double
'Similar to Value1 Mod Value2 only you can do bigger values