2 Mart 2017 Perşembe

Delphide uygulamanın veya dll in path ın bulunması


function GetAppFilePathAndName: string;
var
  pName: PChar;
  pName2: PChar;
  index: integer;
begin
  GetMem(pName, 200);
  Windows.GetModuleFileName(HInstance, pName, 200);
  result := string(pName);
  index := Pos(':', result);
  if index > 1 then
  begin
    pName2 := @pName[index - 2];
    result := string(pName2);
  end
  else
    result := string(pName);

  FreeMem(pName);
end;

Hiç yorum yok:

Yorum Gönder