Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 201435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:11:56+00:00 2026-05-11T17:11:56+00:00

I would like to declare an external function from the kernel32.dll library whose name

  • 0

I would like to declare an external function from the kernel32.dll library whose name is GetTickCount64. As far as I know, it is defined only in Vista and in later Windows versions. This means that when I define the function as follows:

function GetTickCount64: int64; external kernel32 name 'GetTickCount64';

I will certainly not be able to run my application on previous versions of Windows because of error generated on application startup.

Is there a workaround to that problem? Let’s say I would like not to include that function when it does not exist and then use some substitute function in my code. How to do that? Are there any compiler directives that would help?
I gues the definition would have to be surrounded by such directive and I would also have to use some directives wherever I use the GetTickCount64 founction, right?

Your help will be appreciated. Thanks in advance.

Mariusz.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:11:56+00:00Added an answer on May 11, 2026 at 5:11 pm

    Declare a function pointer of that type, and then load the function at run time with LoadLibrary or GetModuleHandle and GetProcAddress. You can find several examples of the technique in the Delphi source code; look at TlHelp32.pas, which loads the ToolHelp library, which isn’t available on older versions of Windows NT.

    interface
    
    function GetTickCount64: Int64;
    
    implementation
    
    uses Windows, SysUtils;
    
    type
       // Don't forget stdcall for API functions.
      TGetTickCount64 = function: Int64; stdcall;
    
    var
      _GetTickCount64: TGetTickCount64;
    
    // Load the Vista function if available, and call it.
    // Raise EOSError if the function isn't available.
    function GetTickCount64: Int64;
    var
      kernel32: HModule;
    begin
      if not Assigned(_GetTickCount64) then begin
        // Kernel32 is always loaded already, so use GetModuleHandle
        // instead of LoadLibrary
        kernel32 := GetModuleHandle('kernel32');
        if kernel32 = 0 then
          RaiseLastOSError;
        @_GetTickCount := GetProcAddress(kernel32, 'GetTickCount64');
        if not Assigned(_GetTickCount64) then
          RaiseLastOSError;
      end;
      Result := _GetTickCount64;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 200k
  • Answers 200k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The trim functions are to be standardised in ECMAScript Fifth… May 12, 2026 at 7:52 pm
  • Editorial Team
    Editorial Team added an answer NSIS uses two Win32 APIs to execute processes ShellExecute (thru… May 12, 2026 at 7:52 pm
  • Editorial Team
    Editorial Team added an answer It looks like doing manage.py reset tagging before running the… May 12, 2026 at 7:52 pm

Related Questions

Ok, here goes. I've completed a Cocoa foundation-tool that calculates mean absolute deviation of
Let's say that I have the following code that's run in one thread of
I am looking for the best practice of handling inter project dependencies between mixed
I'm trying to Entitify some external table (which I don't administer) in order to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.