Necesito ayuda...

Iniciado por IvanUgu, 17 Noviembre 2008, 14:39 PM

0 Miembros y 1 Visitante están viendo este tema.

Dessa

Probé con un celeron D 2.4, ahora voy a prubar con un PIII y un Dual Core. 
Adrian Desanti

IvanUgu

yo tambien tengo ese problema mira el code

Private Sub Command2_Click()
Secuencia:
If Me.Caption <> 100 Then
    Me.Caption = Me.Caption + 1
   
    Sleep (0.5)
   
    GoTo Secuencia
End If
End Sub


si cambio el Sleep (0.6) ya va muchisimo mas lento, pruevenlo...

Private Sub Command2_Click()
Secuencia:
If Me.Caption <> 100 Then
    Me.Caption = Me.Caption + 1
   
    Sleep (0.6)
   
    GoTo Secuencia
End If
End Sub


Lo que necesito es dar pocos milisegundos y con Sleep me parece que no se puede...
   

Para atrapar a un ladron se necesita otro ladron...
El diablo sabe por diablo, pero mas sabe por viejo...

cobein

http://www.advancevb.com.ar
Más Argentino que el morcipan
Aguante el Uvita tinto, Tigre, Ford y seba123neo
Karcrack es un capo.

Dessa

#13
Probé con un dual core E-5200 y lo mismo, no lo pude bajar, no creo que sea problema de micro, voy a probar con tu code IvanUgu y con el de Cobein. Saludos
Adrian Desanti

Dessa

#14
Tampoco puedo con QueryPerformanceCounter (es 0 o 16 Milisegundos)



Private Type LARGE_INTEGER
    LowPart As Long
    HighPart As Long
End Type
Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As LARGE_INTEGER) As Long
Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As LARGE_INTEGER) As Long
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Sub Command1_Click()
    'KPD-Team 2001
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net


Me.Print GetTickCount

    Dim T As Long, liFrequency As LARGE_INTEGER, liStart As LARGE_INTEGER, liStop As LARGE_INTEGER
    Dim cuFrequency As Currency, cuStart As Currency, cuStop As Currency
    'Retrieve the frequency of the performance counter
    If QueryPerformanceFrequency(liFrequency) = 0 Then
        MsgBox "Your hardware doesn't support a high-resolution performance counter!", vbInformation
    Else
        'convert the large integer to currency
        cuFrequency = LargeIntToCurrency(liFrequency)
        'retrieve tick count
        QueryPerformanceCounter liStart
        'do something
        '*****************************************************
        '*****************************************************
        '*****************************************************
        '*****************************************************
        '*****************************************************
        For T = 0 To 20000
        'For T = 0 To 100000
            DoEvents
        Next T
        '*****************************************************
        '*****************************************************
        '*****************************************************
        '*****************************************************
        '*****************************************************
     
       
        'retrieve tick count
        QueryPerformanceCounter liStop
        'convert large integers to currency's
        cuStart = LargeIntToCurrency(liStart)
        cuStop = LargeIntToCurrency(liStop)
        'calculate how many seconds passed, and show the result
        Me.Print CStr((cuStop - cuStart) / cuFrequency)

Me.Print GetTickCount

    End If

End Sub

Private Function LargeIntToCurrency(liInput As LARGE_INTEGER) As Currency
    'copy 8 bytes from the large integer to an ampty currency
    CopyMemory LargeIntToCurrency, liInput, LenB(liInput)
    'adjust it
    LargeIntToCurrency = LargeIntToCurrency * 10000
End Function

Private Sub Form_Paint()

    'KPD-Team 2001
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    Me.Print GetTickCount

    Dim T As Long, liFrequency As LARGE_INTEGER, liStart As LARGE_INTEGER, liStop As LARGE_INTEGER
    Dim cuFrequency As Currency, cuStart As Currency, cuStop As Currency
    'Retrieve the frequency of the performance counter
    If QueryPerformanceFrequency(liFrequency) = 0 Then
        MsgBox "Your hardware doesn't support a high-resolution performance counter!", vbInformation
    Else
        'convert the large integer to currency
        cuFrequency = LargeIntToCurrency(liFrequency)
        'retrieve tick count
        QueryPerformanceCounter liStart
        'do something
        '*****************************************************
        '*****************************************************
        '*****************************************************
        '*****************************************************
        '*****************************************************
        For T = 0 To 20000
        'For T = 0 To 100000
            DoEvents
        Next T
        '*****************************************************
        '*****************************************************
        '*****************************************************
        '*****************************************************
        '*****************************************************
     
       
        'retrieve tick count
        QueryPerformanceCounter liStop
        'convert large integers to currency's
        cuStart = LargeIntToCurrency(liStart)
        cuStop = LargeIntToCurrency(liStop)
        'calculate how many seconds passed, and show the result
        Me.Print CStr((cuStop - cuStart) / cuFrequency)

Me.Print GetTickCount

End If


End Sub




Tal vez con una "ayudita" de Cobein resultaría

Adrian Desanti

IvanUgu

A mi me pasa lo mismo no puedo hacer menos de 16ms  :xD
   

Para atrapar a un ladron se necesita otro ladron...
El diablo sabe por diablo, pero mas sabe por viejo...