This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

thread

By: a guest on Nov 7th, 2011  |  syntax: Pascal  |  size: 0.85 KB  |  views: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Thread--------------------------------
  2.  
  3. unit Unit2;
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes , IdHTTP;
  9.  
  10. type
  11.   TPrimeThrd = class(TThread)
  12.   private
  13.   idHTTP1: TidHTTP;
  14.   FResultString: string;
  15.   protected
  16.   procedure UpdateResults;
  17.   procedure Execute; override;
  18.   public
  19.    filename:string;
  20.   end;
  21.  
  22. implementation
  23.  
  24. uses SysUtils, Dialogs, unit1;
  25.  
  26. procedure TPrimeThrd.UpdateResults;
  27. begin
  28. Form1.Memo1.Lines.Add(FResultString)
  29. end;
  30.  
  31. procedure TPrimeThrd.Execute;
  32. begin
  33. idhttp1:=TIdHTTP.Create(nil);
  34. FResultString:=idhttp1.Get(filename);
  35. Synchronize(UpdateResults);
  36. end;
  37.  
  38. end.
  39. ----------------main form----
  40. procedure TForm1.Button5Click(Sender: TObject);
  41. var
  42. newthread1,newthread2:TPrimeThrd;
  43. begin
  44. newthread1:=TPrimeThrd.Create(true);
  45. newthread1.FreeOnTerminate:=true;
  46. newthread1.filename:=listbox1.Items[0];
  47. newthread1.Resume;
  48. end;
  49. end.
  50.  
clone this paste RAW Paste Data