Mam taki, błąd, jednak nie mam bladego pojęcia z czego on wynika i jak się za niego zabrać...
Problem pojawia się przy tym kodzie, który jest na saaaamym końcu w Button2.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw, ComCtrls, ExtCtrls, CoolTrayIcon,
INIFiles, AppEvnts, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP, IdBaseComponent ;
type
TForm1 = class(TForm)
CoolTrayIcon1: TCoolTrayIcon;
Timer1: TTimer;
Image1: TImage;
Image2: TImage;
Image3: TImage;
Shape1: TShape;
Panel1: TPanel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
ProgressBar1: TProgressBar;
ProgressBar2: TProgressBar;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
Image4: TImage;
ApplicationEvents1: TApplicationEvents;
IdHTTP1: TIdHTTP;
Button2: TButton;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure CoolTrayIcon1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure ApplicationEvents1Minimize(Sender: TObject);
procedure ApplicationEvents1Restore(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ikonka : byte;
sciaganie : byte;
_x,_y,_z : integer;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
timer1.Enabled := false;
if ikonka = 1 then
begin
ikonka := 2;
CoolTrayIcon1.Icon.LoadFromFile('C:\Users\Piotr\Desktop\gmpobieracz\icon2.ico');
end
else
begin
ikonka := 1;
CoolTrayIcon1.Icon.LoadFromFile('C:\Users\Piotr\Desktop\gmpobieracz\icon1.ico');
end;
//timer1.Enabled := true;
end;
procedure TForm1.FormCreate(Sender: TObject);
Var
INI : TINIFile;
windstate : string;
begin
ikonka := 1;
sciaganie := 0;
INI := TINIFile.Create(ExtractFilePath(Application.ExeName) + 'setup.ini');
try
windstate := INI.ReadString('Main', 'ws', '');
sciaganie := strtoint(INI.ReadString('Main', 'sciaganie', '0'));
Edit1.Text := INI.ReadString('Main', 'y1', '0');
Edit4.Text := INI.ReadString('Main', 'y2', '0');
Edit2.Text := INI.ReadString('Main', 'x1', '0');
Edit3.Text := INI.ReadString('Main', 'x2', '0');
_x := strtoint(INI.ReadString('Main', '_x', Edit2.Text));
_y := strtoint(INI.ReadString('Main', '_y', Edit1.Text));
_z := strtoint(INI.ReadString('Main', '_z', '21'));
Label1.Caption := 'X: '+inttostr(_x);
Label2.Caption := 'Y: '+inttostr(_y);
Label3.Caption := 'Z: '+inttostr(_z);
finally
INI.Free;
end;
if sciaganie = 1 then
begin
Button1.Caption := 'Stop';
Edit1.Enabled := false;
Edit2.Enabled := false;
Edit3.Enabled := false;
Edit4.Enabled := false;
Edit1.Color := clBtnFace;
Edit2.Color := clBtnFace;
Edit3.Color := clBtnFace;
Edit4.Color := clBtnFace;
Timer1.Enabled := true;
end;
if windstate = 'wsMinimized' then
Form1.WindowState := wsMinimized;
end;
procedure TForm1.CoolTrayIcon1Click(Sender: TObject);
begin
CoolTrayIcon1.ShowMainForm;
end;
procedure TForm1.Button1Click(Sender: TObject);
Var
INI : TINIFile;
begin
if sciaganie = 0 then
begin
sciaganie := 1;
Button1.Caption := 'Stop';
Edit1.Enabled := false;
Edit2.Enabled := false;
Edit3.Enabled := false;
Edit4.Enabled := false;
Edit1.Color := clBtnFace;
Edit2.Color := clBtnFace;
Edit3.Color := clBtnFace;
Edit4.Color := clBtnFace;
INI := TINIFile.Create(ExtractFilePath(Application.ExeName) + 'setup.ini');
try
INI.WriteString('Main', 'y1', Edit1.Text);
INI.WriteString('Main', 'y2', Edit4.Text);
INI.WriteString('Main', 'x1', Edit2.Text);
INI.WriteString('Main', 'x2', Edit3.Text);
_x := strtoint(INI.ReadString('Main', '_x', Edit2.Text));
_y := strtoint(INI.ReadString('Main', '_y', Edit1.Text));
_z := strtoint(INI.ReadString('Main', '_z', '21'));
finally
INI.Free;
end;
Timer1.Enabled:=true;
end
else
begin
sciaganie := 0;
Button1.Caption := 'Start';
Edit1.Enabled := true;
Edit2.Enabled := true;
Edit3.Enabled := true;
Edit4.Enabled := true;
Edit1.Color := clWindow;
Edit2.Color := clWindow;
Edit3.Color := clWindow;
Edit4.Color := clWindow;
Timer1.Enabled:=false;
end;
INI := TINIFile.Create(ExtractFilePath(Application.ExeName) + 'setup.ini');
try
INI.WriteString('Main', 'sciaganie', inttostr(sciaganie));
finally
INI.Free;
end;
end;
procedure TForm1.ApplicationEvents1Minimize(Sender: TObject);
Var
INI : TINIFile;
begin
INI := TINIFile.Create(ExtractFilePath(Application.ExeName) + 'setup.ini');
try
INI.WriteString('Main', 'ws', 'wsMinimized');
finally
INI.Free;
end;
end;
procedure TForm1.ApplicationEvents1Restore(Sender: TObject);
Var
INI : TINIFile;
begin
INI := TINIFile.Create(ExtractFilePath(Application.ExeName) + 'setup.ini');
try
INI.WriteString('Main', 'ws', 'wsNormal');
finally
INI.Free;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
ms: TMemoryStream;
begin
ms:= TMemoryStream.Create;
try
Form1.IdHTTP1.Get('http://adres.com/index.php?x='+pchar(_x)+'&y='+pchar(_y)+'&z='+pchar(_z), ms);
ms.Position:= 0;
ms.SaveToFile('C:\Users\Piotr\Desktop\ograzek.jpeg');
finally
ms.Free;
end;
end;
end.