Delphi – How to call External .dll in Delphi


Can anyone here show me how can I call external dll file in Delphi?

Best Solution

The documentation covers this topic here: Procedures and Functions, External Declarations.

As an example, the documentation shows how to link to the Windows API function MessageBox:

function MessageBox(
    hWnd: HWND; 
    lpText: PWideChar;
    lpCaption: PWideChar; 
    uType: UINT
 ): Integer; stdcall; external 'user32.dll' name 'MessageBoxW';

Note: I corrected the multitude of errors in the documentation's declaration of this function.

Related Question