Results 1 to 11 of 11

Thread: Milli Seconds in VB

  1. #1

    Thread Starter
    Member KHAWAR's Avatar
    Join Date
    Dec 2003
    Location
    SYDNEY
    Posts
    52

    Post Milli Seconds in VB

    Can anybody tell me that how can i take mili seconds in VB

    Thanks

  2. #2
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442
    What exactly do u want?

    VB Code:
    1. Private Declare Function GetTickCount& Lib "kernel32" ()
    2.  
    3. MsgBox GetTickCount 'Miliseconds since windows was started

    Or just Seconds / 1000
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

  3. #3
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    The GetTickCount API does not have a resolution of one ms. Neither do the Timer. If you want that you have to have to use (Can't remember what it is called QuereryPerformance API. THat has a better resolution then GetTickCount

  4. #4
    Fanatic Member
    Join Date
    Dec 2003
    Posts
    703
    Indeed - if you need millisecond or better timing, look at the QueryPerformanceCounter & QueryPerformanceFrequency APIs. The latter gives you the actual resolution, the former lets you do timing.
    an ending

  5. #5
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    Unfortunately, after a couple of moderately lengthy discussions about microsecond or higher resolution timing in VB, you really need C/C++ or most likely Assembly to get the job done. Millisecond, though, should work fine with their code.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  6. #6
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    the quererieperformanse APIs has a better resolution then 1ms, but not as good as 1(y)s, but I don't think that was the point here either...

  7. #7
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    I was just (probably over-) covering the topic

    Oh well, I got around 5 hours sleep, so don't mind me.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  8. #8
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    5 hours of sleep...I can't remember last time I got that much....

  9. #9
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    BTW I was thinking of what you said about the QuerrieryPerformance API, I am not sure what is making up the resolution of that API. But it is not VBs fault that you have a that ****ed up resolution on the GetTickCount API. It is your OS fault. Every Win OS has diffrent resolution on that API, and if I guess I think it has to be the same with QuerreryPerformance.

  10. #10
    Fanatic Member
    Join Date
    Dec 2003
    Posts
    703
    I think the resolution of the QPC api depends on the hardware rather than the OS. It's not actually guaranteed to be available, though I'd think any non-ancient pc would have the feature..

    btw the resolution of GTC is apparently ~55ms on Win9x..pretty poor really.
    an ending

  11. #11
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Yeah something like that. I don't have MSDN on this LapTop but the resolution is writen if you look it up there. I think it is about 15ms for Win2k...

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