Fórum Como variavel funcionar dentro do comando WINEXEC #329701
19/09/2006
0
Fia assim mais da erro ele naum reconhece que o nome1 e uma variavel e naum le a informação dentro dele. fiz assim
procedure TForm1.BitBtn1Click(Sender: TObject);
var
nome1,nome2,nome3,nome4,nome5,nome6,nome7 : string;
begin
nome1 := Edit1.Text;
nome2 := Edit2.Text;
nome3 := Edit3.Text;
nome4 := Edit4.Text;
nome5 := Edit5.Text;
nome6 := Edit6.Text;
nome7 := Edit7.Text;
if FileExists(nome1) then
WinExec(PChar(´d:\Arquivos de Programas\winrar\winrar a -vf -vd -s ´c:\nome1.rar´ ´´nome1´´´),1) <--- E AQUI O PROBLEMA
else
ShowMessage(´tem naum´);
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
nome1,nome2,nome3,nome4,nome5,nome6,nome7 : string;
begin
nome1 := Edit1.Text;
nome2 := Edit2.Text;
nome3 := Edit3.Text;
nome4 := Edit4.Text;
nome5 := Edit5.Text;
nome6 := Edit6.Text;
nome7 := Edit7.Text;
if FileExists(nome1) then
WinExec(PChar(´d:\Arquivos de Programas\winrar\winrar a -vf -vd -s ´c:\nome1.rar´ ´´nome1´´´),1) <--- E AQUI O PROBLEMA
else
ShowMessage(´tem naum´);
end;
Digital_man
Curtir tópico
+ 0
Responder
Posts
19/09/2006
Micheus
Tente alterar como abaixo - vc deve utiliza o (+) para concatenar as strings:
WinExec(PChar(´d:\Arquivos de Programas\winrar\winrar a -vf -vd -s ´c:\nome1.rar´ ´´[color=red:5b0b33d6ef][b:5b0b33d6ef] + [/b:5b0b33d6ef][/color:5b0b33d6ef]nome1[color=red:5b0b33d6ef][b:5b0b33d6ef] + [/b:5b0b33d6ef][/color:5b0b33d6ef]´´´),1)
Mas ficaria melhor se vc atribuisse tudo isso a uma variável string e depois passasse a função:
WinExec(PChar(´d:\Arquivos de Programas\winrar\winrar a -vf -vd -s ´c:\nome1.rar´ ´´[color=red:5b0b33d6ef][b:5b0b33d6ef] + [/b:5b0b33d6ef][/color:5b0b33d6ef]nome1[color=red:5b0b33d6ef][b:5b0b33d6ef] + [/b:5b0b33d6ef][/color:5b0b33d6ef]´´´),1)
Mas ficaria melhor se vc atribuisse tudo isso a uma variável string e depois passasse a função:
var parametros :string begin parametros := ´d:\Arquivos de Programas\winrar\winrar a -vf -vd -s "c:\nome1.rar" "´ + nome1 + ´"´; WinExec(PChar(Parametros), 1) ...
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)