Hola todos.. me dijeron que esta api era la mas exacta relacionada con el tiempo... ¿pero como es que se usa?
nunca habia escuchado de esta api..
¿Como puedo hacer para que me vaya poniendo el tiempo en milisegundos en un label?
Gracias
Hola todos.. me dijeron que esta api era la mas exacta relacionada con el tiempo... ¿pero como es que se usa?
nunca habia escuchado de esta api..
¿Como puedo hacer para que me vaya poniendo el tiempo en milisegundos en un label?
Gracias
"Los únicos seres reales son los que nunca han existido"
Hola,es un ejemplo del Api-Guide:
En un Modulo:
En un Form ,con un boton y un Timer:Código:Option Explicit Public Const TIME_ONESHOT = 0 'Event occurs once, after uDelay milliseconds. Public Const TIME_PERIODIC = 1 'Event occurs every uDelay milliseconds. Public Const TIME_CALLBACK_EVENT_PULSE = &H20 'When the timer expires, Windows calls thePulseEvent function to pulse the event pointed to by the lpTimeProc parameter. The dwUser parameter is ignored. Public Const TIME_CALLBACK_EVENT_SET = &H10 'When the timer expires, Windows calls theSetEvent function to set the event pointed to by the lpTimeProc parameter. The dwUser parameter is ignored. Public Const TIME_CALLBACK_FUNCTION = &H0 'When the timer expires, Windows calls the function pointed to by the lpTimeProc parameter. This is the default. Public Declare Function timeKillEvent Lib "winmm.dll" (ByVal uID As Long) As Long Public Declare Function timeSetEvent Lib "winmm.dll" (ByVal uDelay As Long, ByVal uResolution As Long, ByVal lpFunction As Long, ByVal dwUser As Long, ByVal uFlags As Long) As Long Public VBTimer As Long, MMTimer As Long Public hMMTimer As Long Sub TimerProc(ByVal uID As Long, ByVal uMsg As Long, ByVal dwUser As Long, ByVal dw1 As Long, ByVal dw2 As Long) MMTimer = MMTimer + 1 End Sub
es cuestion de ir aumentando mas o menos el valor de la variable y del timer asi logras los milisegundos o lo que quieras..Código:Option Explicit Private Sub Form_Load() Command1.Caption = "Start" End Sub Private Sub Form_Unload(Cancel As Integer) timeKillEvent hMMTimer Timer1.Enabled = False End Sub Private Sub Timer1_Timer() VBTimer = VBTimer + 1 Me.Caption = VBTimer End Sub Private Sub Command1_Click() If Command1.Caption = "Start" Then Timer1.Interval = 1 Timer1.Enabled = True hMMTimer = timeSetEvent(1, 0, AddressOf TimerProc, 0, TIME_PERIODIC Or TIME_CALLBACK_FUNCTION) Command1.Caption = "Stop" Else timeKillEvent hMMTimer Timer1.Enabled = False Command1.Caption = "Start" MsgBox "Timer1_Timer was called " & VBTimer & " times;" & vbNewLine & "TimerProc was called " & MMTimer & " times." VBTimer = 0 MMTimer = 0 End If End Sub
saludos.
Todos somos ignorantes;lo que pasa es que no todos ignoramos las mismas cosas - Albert Einstein