ReNamer:Scripts:Import DLL

From den4b Wiki
Revision as of 16:01, 8 February 2017 by Den4b (talk | contribs) (Text replacement - "</source>" to "</syntaxhighlight>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This simple script demonstrates the syntax for importing functions from DLL files.

Two functions are imported from a common "kernel32.dll" which exists on all Windows platforms. One function which gets the current tick count (number of milliseconds that have elapsed since the system was started) and a simple sleep function.


function GetTickCount: Longint;
  external 'GetTickCount@kernel32.dll stdcall';

procedure Sleep(Milliseconds: Cardinal);
  external 'Sleep@kernel32.dll stdcall';

  FileName := IntToStr(GetTickCount);