GetTickCount API

A

Alain Dekker

I'm using GetTickCount exported from kernel32.dll as follows:
Private Declare Function GetTickCount Lib "kernel32 as Long ' Taken from
several web sources

I'm curious. Why is the type Long (64-bit, signed)? All my previous
compilers (Delphi 7, Visual C++ 6, Visual C++ in VS2003.NET) have returned a
DWORD (unsigned 32-bit number).

The MSDN documentation states that:
DWORD WINAPI GetTickCount(void);
http://msdn.microsoft.com/en-us/library/ms724408(VS.85).aspx

Questions:
* Why does VB return a signed 64-bit number?
* Why doesn't VB have a unsigned 32-bit integer data type anyway? Its got a
8-bit and 16-bit unsigned type, but no 32-bit unsigned.
* What are the units of the VB GetTickCount version? Normally its ms, but
the numbers being returned don't seem to support that.
* Is the VB.NET version somehow more "accurate" or just the way it is
because of the missing unsigned 32-bit integer data type?

Thanks,
Alain
 
W

Wilson, Phil

Inline......from my experience with it.
--
Phil Wilson
The Definitive Guide to Windows Installer
http://www.apress.com/book/view/1590592972


Alain Dekker said:
I'm using GetTickCount exported from kernel32.dll as follows:
Private Declare Function GetTickCount Lib "kernel32 as Long ' Taken
from several web sources

I'm curious. Why is the type Long (64-bit, signed)? All my previous
compilers (Delphi 7, Visual C++ 6, Visual C++ in VS2003.NET) have returned
a DWORD (unsigned 32-bit number).

[[ Wraparound is a classic issue with this. Nobody wants to see it suddenly
become zero, as the docs mention. That's in the docs.]]
The MSDN documentation states that:
DWORD WINAPI GetTickCount(void);
http://msdn.microsoft.com/en-us/library/ms724408(VS.85).aspx

Questions:
* Why does VB return a signed 64-bit number?

[[ Which VB? Maybe the one that calls GetTickCount64? ]]
* Why doesn't VB have a unsigned 32-bit integer data type anyway? Its got
a 8-bit and 16-bit unsigned type, but no 32-bit unsigned.

[[ No idea. That's VB question. ]]
* What are the units of the VB GetTickCount version? Normally its ms, but
the numbers being returned don't seem to support that.

[[ It's best just to treat it as a number. If you want to time things there
are other ways. The docs mention resolution.]]
* Is the VB.NET version somehow more "accurate" or just the way it is
because of the missing unsigned 32-bit integer data type?

[[ I'd look at the code and see what it calls. It's just an incementing
integer, there's no accuracy involved, just bigger values. ]]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top