方法1:<br><br>function ReadDLLPath : String;<br>var<br> DLLPath : String;<br> FN: array[0..MAX_PATH- 1] of char;<br>begin<br> SetString(DLLPath, FN, GetModuleFileName(hInstance, FN, SizeOf(FN)));<br> DLLPath := ExtractFileDir(DLLPath);<br> if Copy(DLLPath,Length(DLlPath),1) <> '/' then<br> DLLPath := DLLPath+'/';<br> Result := DLLPath;<br>end;<br><br>==================================<br>方法2:<br>var <br> P: PChar;<br> szFileName :array[0..256] of char;<br> szModuleName :array[0..19] of char;<br> iSize :integer; <br><br>begin<br> strCopy(szModuleName,'Mydll.dll');<br> iSize := GetModuleFileName(getModuleHandle(szModuleName),szFileName,sizeOf(szFileName));<br> P := StrRScan(szFileName, '/');<br> p^:= #0;<br>end;<br><br>szFileName就是你要的路径<br>