PDA

Ver la Versión Completa : Ayuda con Tfomrs en Run Time


MaxiDucoli
02-06-2013, 04:42:41
Hola, tengo un problema que no puedo resolver y no se por que.
Estoy haciendo una aplicación que al hacer click en un botón me tiene que crear un Tform, un Tprogressbar, un Tcaption y un TJvCreateProcess.
Hasta ahí todo bien, pero lo que yo necesito es que sean muchos en algunas ocaciones y ahí está mi problema.
No puedo hacer que se creen muchos forms con los componentes. Cuando creo uno y le vuelvo a dar click mientras ese se está ejecutando, el que está en ejecución deja de hacer la tarea que está haciendo (baja un video de internet) y es como que la tarea se agrega al nuevo y así con todos.
Se entiende?
Les dejo el código que hice a ver si me pueden orientar, por que no me sale.

procedure TForm1.SelectDirectory1Click(Sender: TObject);
var
dir : TJvSelectDirectory;
begin
dir := TJvSelectDirectory.create(self);
dir.Title := 'Youtube Link Monitor';
if (dir.execute) then
begin

if dir.Directory <> '' then
begin
Existen := true;
MyForms := TForm.Create(self);
//MyForms.Height := 80;
//MyForms.Width := 160;
Myforms.OnClose := CerrarMyForm;
MyForms.BorderStyle := BsSizeToolWin;
//MyForms.Top := Screen.width - 10;
MyForms.Name := 'Form_' + IntToStr(Form1.ComponentCount - 1);
MyForms.AutoSize := true;
MyProgress := TProgressbar.Create(MyForms);
MyProgress.Name := 'Progress_' + IntToStr(Form1.ComponentCount - 1);
MyProgress.Parent := MyForms;
MyProgress.Align := alTop;
MyCaption := TLabel.create(MyForms);
MyCaption.Name := 'Caption_' + IntToStr(Form1.ComponentCount - 1);
MyCaption.Parent := MyForms;
//MyCaption.WordWrap := false;
MyCaption.AutoSize := true;
MyCaption.top := MyProgress.Height + 1;
//MyCaption.Align := albottom;
MyForms.FormStyle := fsStayOnTop;
MyForms.Left := Screen.height - MyForms.Height - 10;
MyForms.Show;
MyProcedure := TJvCreateProcess.Create(MyForms);
MyProcedure.Name := 'process_' + IntToStr(Form1.ComponentCount - 1);
MyProcedure.OnTerminate := terminar;
MyProcedure.OnRawRead := leerdatos;
MyProcedure.ConsoleOptions := [coRedirect];
MyProcedure.CreationFlags := [cfSharedWdm, cfUnicode];
MyProcedure.StartupInfo.ShowWindow := swHide;
Myprocedure.StartupInfo.DefaultPosition := False;
Myprocedure.StartupInfo.DefaultWindowState := False;
Myprocedure.StartupInfo.DefaultSize := False;
MyProcedure.ApplicationName := ExtractFilePath(ParamStr(0)) + 'Prgs\youtube-dl.exe';
MyProcedure.CurrentDirectory := Dir.Directory;
MyProcedure.CommandLine := ' ' + CopyText;
MyProcedure.Run;
//MyForms.Free;
//MyCaption.Free;
//MyProgress.Free;
//MyProcedure.Free;
//MyProcedure.OnRead(

//Ejecutar.CurrentDirectory := dir.Directory;
//Ejecutar.CommandLine := ' ' + s;
//Ejecutar.Run;

end;
end;

end;

Muchas gracias de ante mano!!