• 0
Sign in to follow this  
Guest Andre Lima

Repetir Funcao

Question

Guest Andre Lima

Ola pessoal. Estou com um problema. Tenho uma procedure e uma funcao. Uma tira um print da tela e a outra converte o print pra jpeg. Como faco pra q execute as 2 funcoes de 3 em 3 segundos?

Olha o codigo.

procedure TForm1.ScreenCapture(Filename: TFilename);

var
DHDC: HDC;
Buffer : TBitmap;

Begin

  begin

  DHDC := GetWindowDC(GetDesktopWindow);
  Buffer := tBitmap.Create;
  Buffer.Width  := Screen.Width;
  Buffer.Height := Screen.Height;
  BitBlt(Buffer.Canvas.Handle,0,0,Screen.Width,Screen.Height,DHDC,0,0,SRCCOPY);
  Buffer.SaveToFile(Filename);
  Buffer.Free;
  ReleaseDC(GetDesktopWindow,DHDC);
  end;
End;


function TForm1.BmpToJpg(cImage: String): Boolean;
var
MyJPEG : TJPEGImage;
MyBMP : TBitmap;
  begin

  cImage:= 'c:\'+NImagem+'';
  Result := False;
    if fileExists(cImage+'.bmp') then
     begin
          MyBMP := TBitmap.Create;
      with MyBMP do
        begin
        try
          LoadFromFile(cImage+'.bmp');
          MyJPEG := TJPEGImage.Create;
          with MyJPEG do
           begin
           assign(MyBMP);
           SaveToFile(cImage+'.jpeg');
           Free;
           Result := True;
           end;
       finally
       Free;
       end;
     end;
  end;
end;

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

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.

Sign in to follow this