Ошибочка Code: Checking project dependencies... Compiling Project1.dproj (Debug configuration) [DCC Hint] Unit1.pas(29): H2365 Override method TNewTheard.execute should match case of ancestor TThread.Execute [DCC Error] Unit1.pas(35): E2029 'END' expected but 'IMPLEMENTATION' found [DCC Error] Unit1.pas(53): E2003 Undeclared identifier: 'PageProfile' [DCC Error] Unit1.pas(53): E2003 Undeclared identifier: 'edit1' [DCC Error] Unit1.pas(53): E2010 Incompatible types: 'string' and 'Text' [DCC Error] Unit1.pas(53): E2029 '(' expected but '+' found [DCC Error] Unit1.pas(56): E2029 Declaration expected but 'IF' found [DCC Error] Unit1.pas(61): E2029 '.' expected but ';' found [DCC Warning] Unit1.pas(62): W1011 Text after final 'END.' - ignored by compiler [DCC Fatal Error] Project1.dpr(5): F2063 Could not compile used unit 'Unit1.pas' Failed Elapsed time: 00:00:00.5 Исходник Code: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; IdHTTP1: TIdHTTP; Edit1: TEdit; Edit2: TEdit; Label1: TLabel; Label2: TLabel; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; TNewTheard = class (TThread) private protected procedure execute; override; public var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var PageProfile:string; begin TNewTheard.Create(false); end; procedure TNewTheard.Execute ; begin Form1.IdHTTP1.AllowCookies:=true; Form1.IdHTTP1.HandleRedirects:=true; try PageProfile:=Form1.IdHTTP1.Get('http://russianproxy.ru/proxy_checker?proxy='+edit1.Text+'&proxy_port='+edit2.Text+''); except end; if Pos('Response time', PageProfile)<>0 then Form1. Memo1.Lines.Add('Прокси сервер: '+edit1.Text+':'+edit2.Text+' Рабочий ') else Form1.Memo1.Lines.Add('Bad'); Form1.Memo1.Lines.Clear ; end; end.
Вроде нельзя юзать в потоках компоненты с форм, т.е. создавай в потоке idhttp. PageProfile обьявляй в самом потоке. Form1.edit1
Code: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; IdHTTP1: TIdHTTP; Edit1: TEdit; Edit2: TEdit; Label1: TLabel; Label2: TLabel; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; TNewTheard = class (TThread) private protected procedure execute; override; public end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var PageProfile:string ; begin TNewTheard.Create(false); end; procedure TNewTheard.Execute ; begin Form1.IdHTTP1.AllowCookies:=true; Form1.IdHTTP1.HandleRedirects:=true; try PageProfile:=Form1.IdHTTP1.Get('http://russianproxy.ru/proxy_checker?proxy='+Form1.edit1.Text+'&proxy_port='+Form1.edit2.Text+''); except end; if Pos('Response time', PageProfile)<>0 then Form1. Memo1.Lines.Add('Прокси сервер: '+Form1.edit1.Text+':'+Form1.edit2.Text+' Рабочий ') else Form1.Memo1.Lines.Add('Bad'); Form1.Memo1.Lines.Clear ; end; end. Code: Checking project dependencies... Compiling Project1.dproj (Debug configuration) [DCC Hint] Unit1.pas(29): H2365 Override method TNewTheard.execute should match case of ancestor TThread.Execute [DCC Hint] Unit1.pas(42): H2164 Variable 'PageProfile' is declared but never used in 'TForm1.Button1Click' [DCC Error] Unit1.pas(54): E2003 Undeclared identifier: 'PageProfile' [DCC Error] Unit1.pas(57): E2250 There is no overloaded version of 'Pos' that can be called with these arguments [DCC Fatal Error] Project1.dpr(5): F2063 Could not compile used unit 'Unit1.pas' Failed Elapsed time: 00:00:00.4
New - Other - TThread Главный код проги: Code: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, StdCtrls, unit2; type TForm1 = class(TForm) Button1: TButton; IdHTTP1: TIdHTTP; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; NEW : Load; // имя твоего потока implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin Load.Create(false); // или как тебе там надо end; end. Код потока: Code: unit Unit2; interface uses Classes; type Load = class(TThread) private { Private declarations } protected procedure Execute; override; end; implementation uses unit1; procedure Load.Execute; begin Form1.IdHTTP1.AllowCookies:= true; // end; end.
PHP: procedure TNewTheard.Execute; var http: tidhttp; page: string; begin http := tidhttp.Create(nil); http.AllowCookies:=true; http.HandleRedirects:=true; try Page := http.Get('http://russianproxy.ru/proxy_checker?proxy=' + form1.edit1.Text + '&proxy_port=' + form1.edit2.Text); except end; if Pos('Response time', Page) <> 0 then Form1.Memo1.Lines.Add('Прокси сервер: ' + form1.edit1.Text + ':' + form1.edit2.Text + 'рабочий ') else Form1.Memo1.Lines.Add('Bad'); end; PHP: procedure TForm1.Button1Click(Sender: TObject); begin TNewTheard.Create(False); end; Вроде работает...
tracy тебе и так тут помогли, куда еще?) Просить вставить свой код , в чужой шаблон (ПМ), это уже сверх наглости и лени, сам
Create(False) - что бы поток сам запустился, сразу после создания. Можно еще и FreeOnTerminate, ну у тебя же этого нету. Ок.