如何在 Delphi 中定义这个函数?我只知道没有入口点的进口,找不到任何有用的例子:(
这是用 C# 编写的
[DllImport("dwmapi.dll", EntryPoint = "#131")]
static extern int DwmpSetColorizationParameters(ref DwmColorParams dcpParams,
bool alwaysTrue);
非常感谢
最好的祝福
如何在 Delphi 中定义这个函数?我只知道没有入口点的进口,找不到任何有用的例子:(
这是用 C# 编写的
[DllImport("dwmapi.dll", EntryPoint = "#131")]
static extern int DwmpSetColorizationParameters(ref DwmColorParams dcpParams,
bool alwaysTrue);
非常感谢
最好的祝福
这应该可以,尽管我不确定const
for alwaysTrue
。
function DwmpSetColorizationParameters(var dcpParams: TDwmColorParams;
alwaysTrue: BOOL): Integer; stdcall;
external 'dwmapi.dll' index 131;
该EntryPoint
字段允许使用与 DLL 用于导出它的名称不同的名称来声明函数。如果值的第一个字符是#
,那么它表示函数的序数值,而不是它的 DLL 名称。
Delphi 使用两个不同的子句。如果 DLL 使用的名称与代码中的名称不同,则可以使用name
子句:
procedure Foo(...); external DLL name 'Bar';
但是如果 DLL 根本不导出任何名称,那么您可以使用一个index
子句来告诉函数具有哪个序数值:
procedure Foo(...); external DLL index 131;