Solved

GetTickCount - Range Check Error

Posted on 2004-03-30
4
1,307 Views
Last Modified: 2011-10-03
For some reason, the windows GetTickCount function causes a range check error.  This is according to bug report logs that I am receiving from my users.

Any ideas why this could be happening?  Can I safely ignore these errors by putting an exception handler around all calls to GetTickCount?
0
Comment
Question by:wolsen
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
ricswika earned 100 total points
ID: 10718518
What data type are you assigning the result to? I use DWORD for this in my apps and don't have a problem.
0
 

Expert Comment

by:necro_ccs
ID: 10732144
GetTickCount is defined as

DWORD GetTickCount(VOID)

I use a Cardinal for this (same as DWORD/LongWord) as well, and have never had a overflow issues
0
 
LVL 2

Author Comment

by:wolsen
ID: 10736992
I am using LongInt and maybe some integers, too.  I will try changing to DWORD, or equivalent.

Thank you.
0
 
LVL 1

Expert Comment

by:ricswika
ID: 10741503
Also make sure all of the other variables used in calcualations involving GetTickCount are DWORD or Cardinal. For, example this may cause an overflow issue. I think the compiler treats the calcuation as integer, thus the overflow.

var
  T: DWORD;
  T0 : Integer = 10;
  K: Integer = 100;

begin
  T := T0 + (GetTickCount*K);
end;
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question