简体   繁体   English

获取BPL文件名

[英]Get BPL File Name

From within a BPL, is it possible to get its own file name? 从BPL中,是否可以获得自己的文件名? eg C:\\foo\\bar.bpl 例如C:\\ foo \\ bar.bpl

(dynamically loaded and delphi7, if it matters) (动态加载和delphi7,如果重要的话)

Call GetModuleFileName . 调用GetModuleFileName For the module handle, use SysInit.HInstance . 对于模块句柄,请使用SysInit.HInstance Passing zero will give you the host EXE's file name instead, also known as ParamStr(0) . 传递零将为您提供主机EXE的文件名,也称为ParamStr(0)

Example use of GetModuleFileName: GetModuleFileName的使用示例:

function  DLLFileName : string;
begin
  SetLength(Result,MAX_PATH);
  GetModuleFileName(HInstance,PCHar(Result),MAX_PATH);
  SetLength(Result,StrLen(PChar(Result)));
end;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM