Can anybody tell me that how can i take mili seconds in VB
Thanks
:o :rolleyes:
Printable View
Can anybody tell me that how can i take mili seconds in VB
Thanks
:o :rolleyes:
What exactly do u want?
VB Code:
Private Declare Function GetTickCount& Lib "kernel32" () MsgBox GetTickCount 'Miliseconds since windows was started
Or just Seconds / 1000
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
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.
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 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...
I was just (probably over-) covering the topic ;)
Oh well, I got around 5 hours sleep, so don't mind me.
5 hours of sleep...I can't remember last time I got that much....;)
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.
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.
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...