GetTickCount

2.x

  DWORD GetTickCount(void)    

The GetTickCount function retrieves the number of milliseconds that have elapsed since Windows was started.

Parameters

This function has no parameters.

Return Value

The return value specifies the number of milliseconds that have elapsed since Windows was started.

Comments

The internal timer will wrap around to zero if Windows is run continuously for approximately 49 days.

The GetTickCount function is identical to the GetCurrentTime function. Applications should use GetTickCount, because its name matches more closely with what the function does.

Example

The following example calls GetTickCount to determine the number of milliseconds that Windows has been running, converts the value into seconds, and displays the value in a message box:

char szBuf[255];

sprintf(szBuf, "Windows has been running for %lu seconds\n",
    GetTickCount() / 1000L);
MessageBox(hwnd, szBuf, "", MB_OK);