Hi filipe26,
using threads this way won't help, since you use Synchronize; using synchronize in a thread is nothing more than executing the code in the main VCL thread (the actual application), this means that the app will be busy encoding your file and will not be able to respond to user input (like mouse and keyboard events). if the classes that you use in the encode() procedure are guaranteed threadsafe, I would change your code like this :
unit _thread;
interface
uses
Classes, deACM
,deAudioStreams,deAudioControls,sysutils;
type
Tmeuthread = class(TThread)
private
{ Private declarations }
entrada,saida:String;
protected
procedure Execute; override;
procedure encode;
public
constructor Criar(fichin,fichout:String);
end;
implementation
uses _Main;
constructor TMeuThread.Criar(fichin,fichout:string);
begin
Create(False);
entrada:=fichin;
saida:=fichout;
FreeOnTerminate := True;
end;
procedure Tmeuthread.Execute;
begin
encode;
end;
procedure Tmeuthread.encode;
{no change}
end.
procedure Tmain.but2Click(Sender: TObject);
var
fazencode:Tmeuthread;
begin
fazencode:=Tmeuthread.Criar(copy.DestFile,saida);
fazencode.resume; // start the thread
end;