Solved

GetTickCount - Range Check Error

Posted on 2004-03-30
4
1,313 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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