Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Mar 2007
Posts: 3
Reputation: vidyahajare is an unknown quantity at this point 
Solved Threads: 0
vidyahajare vidyahajare is offline Offline
Newbie Poster

Re: Text Timer

 
0
  #11
Mar 29th, 2007
thanks a million for explaining the use of getsystemtime() .
i was luking for that particular peiece of onfo very badly.
it's really ossom

vidya
Originally Posted by Comatose View Post
Alright, I've Got It:

You Need To Add A Plain Ole Standard Module (It's A Good Practice), inside of the module add this:

Module Code:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Public Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
  2. Public Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
  3.  
  4. Public Type SYSTEMTIME
  5. wYear As Integer
  6. wMonth As Integer
  7. wDayOfWeek As Integer
  8. wDay As Integer
  9. wHour As Integer
  10. wMinute As Integer
  11. wSecond As Integer
  12. wMilliseconds As Integer
  13. End Type

In your form load event, You'll need this code:

Form Load Code
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim GMTime As SYSTEMTIME
  2. Dim TheTime As String
  3. GetSystemTime GMTime
  4.  
  5. Text1.Text = GMTime.wHour & ":" & GMTime.wMinute & ":" & GMTime.wSecond & "." & GMTime.wMilliseconds
  6.  
  7. For x = 1 To 10000
  8. Print "Frost"
  9. Next
  10.  
  11. GetSystemTime GMTime
  12.  
  13. Text2.Text = GMTime.wHour & ":" & GMTime.wMinute & ":" & GMTime.wSecond & "." & GMTime.wMilliseconds
  14. Timer1.Interval = 1
  15. Label1.Caption = ""

And Lastly in your timer event:

Timer Event Code:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim GMTime As SYSTEMTIME
  2. Dim TheTime As String
  3. GetSystemTime GMTime
  4.  
  5. Label1.Caption = GMTime.wHour & ":" & GMTime.wMinute & ":" & GMTime.wSecond & "." & GMTime.wMilliseconds

So Far, This works flawlessly for me. Let me know how it works for you.... if you need an additional help, let me know.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC