destructor TPostMsg.Destroy;
begin
{code here}
inherited Destroy;
end;
procedure TPostMsg.ThreadDone(Sender: TObject);
begin
FPostState:=FStartPostThread.FPostState;
FHTTPBody:=FStartPostThread.FHTTPBody;
FStartPost:=false;
FStartGet:=false;
FStartPostThread:=nil;
end;
procedure TPostMsg.setStartPost(Value:boolean);
begin
if Value<>FStartPost then
begin
FStartPost:=Value;
if FStartPost then
if not Assigned(FStartPostThread) then
begin
FPostState:=-1;
FStartPostThread := TPostMsgThread.Create(FContentType,FUserName,FPassWord,FPostUrl,FPostBody);
FStartPostThread.OnTerminate := ThreadDone;
end;
end;
end;
procedure TPostMsg.setStartGet(Value:boolean);
begin
if Value<>FStartGet then
begin
FStartGet:=Value;
if FStartGet then
if not Assigned(FStartPostThread) then
begin
FPostState:=-1;
FStartPostThread := TPostMsgThread.Create(FContentType,FUserName,FPassWord,FPostUrl,FPostBody);
FStartPostThread.OnTerminate := ThreadDone;
end;
end;
end;
procedure TPostMsg.Abort;
begin
if Assigned(FStartPostThread) then
begin
try
FStartPostThread.http.DisconnectSocket;
FStartPostThread.Terminate;
except
end;
end;
end;
end.