Results 1 to 14 of 14

Thread: Timers [Faster Time]

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2006
    Posts
    51

    Re: Timers [Faster Time]

    so, since this way looks awesome... lol ( Thats a huge thanks ^^; )

    Can i finish my program, and then like email you the form, becasue i still dont know how im going to incorporate this in the way i would like to

    Thanks a ton!

  2. #2

    Thread Starter
    Member
    Join Date
    Nov 2006
    Posts
    51

    Re: Timers [Faster Time]

    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:
    1. private sub timer1_timer()
    2. 'Your cude is processed for every interval
    3. end sub

    how am i going to do this for your code?

    VB Code:
    1. private sub seconds()
    2. msgbox "Look at me, im so annoying, i appear every second :D"
    3. end sub

    something like that maby?

    Thankyou
    ~Cody
    Attached Files Attached Files

  3. #3
    Addicted Member Jazz00006's Avatar
    Join Date
    Feb 2006
    Posts
    185

    Re: Timers [Faster Time]

    I'm probably wrong here, but

    VB Code:
    1. Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As Currency) As Long
    2. Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpCount As Currency) As Long
    3.  
    4. Private Tick_Count As Currency
    5. Private Start_Time As Currency
    6. Private End_Time As Currency
    7. Private Delta_Time As Currency
    8.  
    9. Private Str As String
    10. Private sub1, sub2, sub3, sub4, sub5, seconds, mins As Long
    11.  
    12. Private Sub Form_Activate()
    13.  
    14.     AutoRedraw = True
    15.    
    16.     ScaleMode = 3
    17.    
    18.     QueryPerformanceFrequency Tick_Count
    19.    
    20.     QueryPerformanceCounter Start_Time
    21.    
    22.     Do
    23.    
    24.         DoEvents
    25.        
    26.         Cls
    27.        
    28.         Delta_Time = (End_Time - Start_Time) / Tick_Count
    29.        
    30.         Caption = Delta_Time
    31.                
    32.         If Delta_Time >= 0.0001 Then
    33.         QueryPerformanceCounter Start_Time
    34.         sub5 = sub5 + 1
    35.     If sub5 = 10 Then
    36.         sub5 = 0
    37.         sub4 = sub4 + 1
    38.         End If
    39.     If sub4 = 10 Then
    40.         sub4 = 0
    41.         sub3 = sub3 + 1
    42.         End If
    43.     If sub3 = 10 Then
    44.         sub3 = 0
    45.         sub2 = sub2 + 1
    46.         End If
    47.     If sub2 = 10 Then
    48.         sub2 = 0
    49.         sub1 = sub1 + 1
    50.         End If
    51.     If sub1 = 10 Then
    52.         sub1 = 0
    53.         seconds = seconds + 1
    54.     End If
    55.     If seconds = 60 Then
    56.         seconds = 0
    57.         mins = mins + 1
    58.     End If
    59.        
    60.        
    61.         QueryPerformanceCounter Start_Time
    62.  
    63.         End If
    64.        
    65.            
    66.            
    67.        
    68.        
    69.         Str = "Time Elapsed: " & mins & seconds & sub1 & sub2 & sub3 & sub4 & sub5
    70.        
    71.         Print Str
    72.        
    73.         QueryPerformanceCounter End_Time
    74.                  
    75.     Loop
    76.  
    77. End Sub


    If i understand it correctly, you were reseting the time constantly so it couldn't add up the numbers for you

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