Delphi Import dll function with specified entry point

How can I define this function in Delphi? I know import only without an entry point and cannot find a useful example :(

It is written in C #

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

thanks a lot

Best wishes

+4
source share
2 answers

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

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

The EntryPoint field allows EntryPoint to declare a function with a name that is different from 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 name for it.

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

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

But if the DLL does not export any name at all, you can use the index clause to indicate what ordinal value the function has:

 procedure Foo(...); external DLL index 131; 
+1
source

Source: https://habr.com/ru/post/1343326/


All Articles