how to create a timer with less than 1ms???

[b][red]This message was edited by yts_83 at 2006-9-4 4:4:47[/red][/b][hr]
Is there any limitation for timer interval in VB6?
I had write a program which employed timer function,but I need a timing interval of 0.008ms,VB6 timer only allowed time interval up to 1ms resolution.How to solve this problem?


Comments

  • You can tap into the Windows API. Here are your options:

    GetTickCount()

    http://www.allapi.net/apilist/GetTickCount.shtml

    - or -

    QueryPerformanceCounter and QueryPerformanceFrequency

    http://www.allapi.net/apilist/QueryPerformanceCounter.shtml
    http://www.allapi.net/apilist/QueryPerformanceFrequency.shtml

    The QueryPerformance functions tap into an extremely high resolution timer. The win32 declares use a Big_Integer type, but you can substitute for the Currency datatype (64-bits) and multiple the return by 10000.

    : [b][red]This message was edited by yts_83 at 2006-9-4 4:4:47[/red][/b][hr]
    : Is there any limitation for timer interval in VB6?
    : I had write a program which employed timer function,but I need a timing interval of 0.008ms,VB6 timer only allowed time interval up to 1ms resolution.How to solve this problem?
    :
    :
    :

  • if so,how i gonna add the GetTickCount() or QueryPerformanceCounter in my code?does I need to employ also the timer?
    For example,my timer code is:
    Private Sub Timer1_Timer()
    Dim period As Long
    Call ReadPortBButton_Click
    Timer1.Interval = 1
    Timer1.Enabled = True

    If i wish to use GetTickCount in my code,what should I modify?


    : You can tap into the Windows API. Here are your options:
    :
    : GetTickCount()
    :
    : http://www.allapi.net/apilist/GetTickCount.shtml
    :
    : - or -
    :
    : QueryPerformanceCounter and QueryPerformanceFrequency
    :
    : http://www.allapi.net/apilist/QueryPerformanceCounter.shtml
    : http://www.allapi.net/apilist/QueryPerformanceFrequency.shtml
    :
    : The QueryPerformance functions tap into an extremely high resolution timer. The win32 declares use a Big_Integer type, but you can substitute for the Currency datatype (64-bits) and multiple the return by 10000.
    :
    : : [b][red]This message was edited by yts_83 at 2006-9-4 4:4:47[/red][/b][hr]
    : : Is there any limitation for timer interval in VB6?
    : : I had write a program which employed timer function,but I need a timing interval of 0.008ms,VB6 timer only allowed time interval up to 1ms resolution.How to solve this problem?
    : :
    : :
    : :
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories