From: Alain Dekker on 23 Feb 2010 06:49 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
From: Wilson, Phil on 23 Feb 2010 13:22 Inline......from my experience with it. -- Phil Wilson The Definitive Guide to Windows Installer http://www.apress.com/book/view/1590592972 "Alain Dekker" <abdekker(a)NOSPAM.fsmail.net> wrote in message news:%23NOTl5HtKHA.712(a)TK2MSFTNGP04.phx.gbl... > 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. ]] > > Thanks, > Alain >
|
Pages: 1 Prev: How to extend Combobox Next: Stylecop SA 1201 and initialization order |