user532231
user532231

Reputation:

delphi Import dll function with specified entry point

How can I define this function in Delphi ? I know imports only without entry point and can't find any usefull example :(

That's written in C#

[DllImport("dwmapi.dll", EntryPoint = "#131")]
static extern int DwmpSetColorizationParameters(ref DwmColorParams dcpParams, 
bool alwaysTrue);

Thanks a lot

Best regards

Upvotes: 4

Views: 2278

Answers (2)

Rob Kennedy
Rob Kennedy

Reputation: 163347

The EntryPoint field allows the function to be declared with a name other than what the DLL used to export it. If the first character of the value is #, then it indicates the ordinal value of the function instead of the DLL's name for it.

Delphi uses two different clauses. If the DLL uses a name different from the one in your code, then you can use a name clause:

procedure Foo(...); external DLL name 'Bar';

But if the DLL doesn't export any name at all, then you can use an index clause to tell which ordinal value the function has:

procedure Foo(...); external DLL index 131;

Upvotes: 1

Ken White
Ken White

Reputation: 125749

This should do, although I'm not sure about the const for alwaysTrue.

function DwmpSetColorizationParameters(var dcpParams: TDwmColorParams; 
  alwaysTrue: BOOL): Integer; stdcall; 
  external 'dwmapi.dll' index 131;

Upvotes: 3

Related Questions