Symbol 'Resume' is deprecated/Thread Error: The handle is invalid (6)

Viewed 2524

I have an old piece of code that I want to upgrade it to Delphi XE. I have a compiler warning about Resume and I want to replace it with Start but the program crashes.

constructor THTTPGetThread.Create(aAcceptTypes, aAgent, aURL, aFileName, aUserName, aPassword, aPostQuery, aReferer: String; aBinaryData, aUseCache: Boolean; aProgress: TOnProgressEvent; aToFile: Boolean);
begin
  FreeOnTerminate := True;
  inherited Create(True);

  FTAcceptTypes := aAcceptTypes;
  FTAgent       := aAgent;
  FTURL         := aURL;
  FTFileName    := aFileName;
  FTUserName    := aUserName;
  FTPassword    := aPassword;
  FTPostQuery   := aPostQuery;
  FTReferer     := aReferer;
  FTProgress    := aProgress;
  FTBinaryData  := aBinaryData;
  FTUseCache    := aUseCache;
  FTToFile      := aToFile;

  Resume;      <------------ works, but I get compiler warning
  //Start;     <------------ doesn't work
end;

The error I get when I use START is: "Thread Error: The handle is invalid (6)".
I don't want complex stuff (freeze/synchronize threads). I just want to download a file from internet without blocking the GUI.

2 Answers
Related