可以试试GetModuleFileName 
函数说明:
Unit
Windows.PasSyntax
GetModuleFileName(
hModule: HINST; {a handle to the module}
lpFilename: PChar; {pointer to a null terminated string buffer}
nSize: DWORD {the size of the lpFilename buffer}
): DWORD; {returns the number of characters copied to the buffer}Description
This function retrieves the full path and filename of the module identified by the handle in the hModule parameter.Parameters
hModule: A handle to the module whose full path and filename are to be retrieved. If this parameter is set to zero, the function returns the full path and filename of the calling process.lpFilename: A pointer to a null terminated string buffer that receives the path and filename.nSize: Specifies the size of the buffer pointed to by the lpFilename parameter, in characters. If the returned path and filename is larger than this value, the string is truncated.Return Value
If the function succeeds, it returns the number of characters copied to the buffer pointed to by the lpFilename parameter; otherwise it returns zero. To get extended error information, call the GetLastError function.The Tomes of Delphi 3: Win32 Core API Help File by Larry Diehl
例子:
library Example;uses
  SysUtils,
  Classes,
  Windows,
  Dialogs,
  DLLAboutForm in 'DLLAboutForm.pas' {AboutBox};{the exported functions}
exports
  ShowAboutBox name 'ShowAboutBox';{the DLL entry point procedure.  this procedure will fire every time a
 process or thread attaches to the DLL.  if a process has attached to a DLL,
 any newly created threads will automatically attach themselves}
procedure DLLMain(AttachFlag: DWORD); begin
  {display attachement type}
  case AttachFlag of
    DLL_PROCESS_ATTACH: MessageBox(0, 'Process: Attaching', 'Alert', MB_OK);
    DLL_PROCESS_DETACH: MessageBox(0, 'Process: Detaching', 'Alert', MB_OK);
    DLL_THREAD_ATTACH:  MessageBox(0, 'Thread: Attaching' , 'Alert', MB_OK);
    DLL_THREAD_DETACH:  MessageBox(0, 'Thread: Detaching' , 'Alert', MB_OK);
  end;
end;begin
  {initialize the DLL entry function}  DLLProc := @DLLMain;  {call the entry function upon DLL initialization}
  DLLMain(DLL_PROCESS_ATTACH);
end.Unit 2{the prototype for the exported function}
  function ShowAboutBox(ExampleName, Comments: ShortString): Boolean; export;var
  AboutBox: TAboutBox;implementation{$R *.DFM}function ShowAboutBox(ExampleName, Comments: ShortString): Boolean;begin
  {initialize the function results}
  Result := FALSE;  {create the about box form}
  AboutBox := TAboutBox.Create(Application);  {initialize labels from the supplied strings}
  AboutBox.ProductName.Caption := ExampleName;
  AboutBox.Comments.Caption := Comments;  {show a modal about box}
  AboutBox.ShowModal;  {release the form}
  AboutBox.Release;  {indicate that the function completed}  Result := TRUE;
end;Loading The Example Dynamic Link Libraryprocedure TForm1.Button1Click(Sender: TObject);
var
   hMod: THandle;                          // holds the DLL handle
   ModuleFileName: array[0..255] of char;  // holds the DLL name   {this is the prototype for the function imported from the DLL}
   MyFunction: function(ExampleName, Comments: ShortString): Boolean;begin
   {explicitly load the DLL}
   hMod := LoadLibrary('EXAMPLE.DLL');
   if (hMod=0) then Exit;   {retrieve the address of the desired function}
   @MyFunction := GetProcAddress(hMod, 'ShowAboutBox' );   {if the address was returned...}
   if (@MyFunction<>nil) then
   begin
     {call the function to display an about box}
     MyFunction('LoadLibrary Example','This example demonstrates loading '+                'a dynamic link library via the LoadLibrary function.');     {retrieve the module filename}
     GetModuleFileName(GetModuleHandle('EXAMPLE.DLL'), @ModuleFileName[0],
                       SizeOf(ModuleFileName));     {display the DLLs name}
     ShowMessage('The loaded DLL was: '+ModuleFileName);
   end
   else
     {indicate an error}
     ShowMessage('GetProcAddress Failed');
   {free the DLL}
   FreeLibrary(hMod);
end;看看吧,不知对你有没有帮助