Can I get my own file name inside BPL? e.g. C: \ Foo \ bar.bpl
(dynamically loaded and delphi7, if that matters)
Call GetModuleFileName . For the module descriptor, use SysInit.HInstance . When going to zero, instead, you get the EXE host name, also called ParamStr(0) .
GetModuleFileName
SysInit.HInstance
ParamStr(0)
An example of using GetModuleFileName:
function DLLFileName : string; begin SetLength(Result,MAX_PATH); GetModuleFileName(HInstance,PCHar(Result),MAX_PATH); SetLength(Result,StrLen(PChar(Result))); end;