14/08/11 23:43
Goblin
La variabile locale FilePath dentro l'evento OnTimer spostala nella sezione private, nel create setta FilePath :='' e nell'evento OnTiner scrivi come prime righe
if FilePath<>'' then
DeleteFile(FilePath);
il tutto diventa
private
{ Private declarations }
FilePath : String;
......
procedure TForm1.FormCreate(Sender: TObject);
begin
WebcamInit;
TimeSeparator:= '_';
ComboBox1.Clear;
WebcamList;
FilePath :='';
end;
.......
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Image1.Picture := Nil; // non so se ci vuole
if FilePath<>'' then // se esiste il file lo sego
if fileexists(FilePath) then
DeleteFile(FilePath);
FilePath := ExtractFilePath(ParamStr(0))+ TimetoStr(Time())+'.bmp';
CaptureWebcam(FilePath);
if fileexists(FilePath) then // lo carico solo se esiste
Image1.Picture.LoadFromFile(FilePath);
end;
NB: non l'ho testato in quanto non ho la cam, ma andando a logica dovrebbe funzionare...
G.
Ultima modifica effettuata da Goblin 14/08/11 23:45
Ibis redibis non morieris in bello