Jump to content
Fórum Script Brasil
  • 0

(Resolvido) Pegar Letra da Unidade do Arquivo Executavel


Eder

Question

Ola...

eu tenho este codigo:

procedure TForm1.XiButton1Click(Sender: TObject);
Var
CAMINHO : STRING;
begin
caminho := extractFilepath(application.ExeName)+'BDADOS';
SHOWMESSAGE(CAMINHO);
end;

ele me traz o caminho do executavel que vai ser extraido + BDADOS

ficando tipo assim:

Y:\PROGRAMA\BDADOS

mas eu gostaria que pegasse somente a Letra da Unidade(Y:\) + PROGRAMA\BDADOS

ficando assim igual:

Y:\PROGRAMA\BDADOS.

Eu queria que extraisse somente a LETRA DA UNIDADE e o resto eu adiciono na MÃO

valeu..Grato

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Opa

Uses

SysUtils;

IncludeTrailingBackslash(extractfiledrive(Application.ExeName));

ExtractFileDrive(); Retorna a letra da unidade com ":"

IncludeTrailingBackSlash(); Adiciona a "\" ao final se não tiver

A função copy tambem pode ser utilizada

var

szDrive: String;

begin

szDrive := Copy(ExtractFilePath(Application.Exename), 1, 3);

abraços

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152k
    • Total Posts
      651.5k
×
×
  • Create New...