Delphi中加载dll,exe的路径
程序员文章站
2022-06-25 18:45:42
...
由于项目中,使用到tcl跟delphi.在配置关于dll的ini文件的时候路径显示在tcl中的bin目录,如下代码
path := ExtractFilePath(Application.ExeName); // 创建在本项目的目录下
showmessage('系统默认存放ini文件路径在' + path1);//配置的路径显示在tcl中的bin目录下
iniFile := TIniFile.Create(Path + 'test.ini');
可以使用
function TfrmDll.GetSelfPath: string;
var
ModuleName: string;
i: Integer;
begin
SetLength(ModuleName, 255);
GetModuleFileName(HInstance, PChar(ModuleName), Length(ModuleName));
i := LastDelimiter('\', ModuleName);
end;
这个函数去显示现在正在运行的dll的路径
上一篇: 动态链接库(一)
推荐阅读