Mam problem mam kod, który po naciśnięciu guzika robi zrzut ekranu.
Ale wyskakują mi błędy, wiem że ten program działa. Robiłem go i zapisywał mi jako BMP, teraz dorzuciłem żeby zamieniał na JPG, ale coś mi nie działa prawdopodobnie coś z "end" to niego dodawałem kilka end'ów, oraz usówałem, ale to nie pomogło. Czy ktoś może wskazać błąd w tym programie.
Oto kod całego programu
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Can: TCanvas;
RysunekBMP : TBitmap;
RysunekJPEG : TJPEGImage;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
try
Can := TCanvas.Create;
Can.Handle := GetWindowDC(GetDesktopWindow);
RysunekBMP := TBitmap.Create;
RysunekBMP.Width := Screen.Width;
RysunekBMP.Height := Screen.Height;
RysunekBMP.Canvas.CopyRect(Rect(0, 0, Screen.Width, Screen.Height),
Can,
Rect (0, 0, Screen.Width, Screen.Height));
try
RysunekBMP.SaveToFile('C:plik.bmp');
RysunekJPEG:=TJPEGImage.Create;
try
RysunekJPEG.Assign(RysunekBMP);
RysunekJPEG.SaveToFile('C:plik.jpg');
finally
Can.Free;
RysunekJPEG.Free;
RysunekBMP.Free;
end;
end.
A oto jakie mi delphi 6 wywala błędy:
[Error] Unit1.pas(47): EXCEPT or FINALLY expected
[Error] Unit1.pas(49): EXCEPT or FINALLY expected
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'