unit StartPostUnit;
interface
uses
Classes,IdBaseComponent,stdctrls,Sysutils,IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP;
type
TPostMsgThread = class(TThread)
private
FContentType:string;
FUserName:string;
FPassWord:string;
FPostUrl:string;
FPostBody:string;
FHTTPBody:string;
FPostState:integer;
HTTP: TIdHTTP;
function PostMsg(ContentType:string;UserName:string;PassWord:string;PostUrl:string;PostBody:string):integer;
function GetMsg(UserName:string;PassWord:string;PostUrl:string):String;
protected
procedure Execute; override;
public
constructor Create(ContentType:string;UserName:string;PassWord:string;PostUrl:string;PostBody:string);
destructor Destroy; override;
end;
type
TPostMsg = class(TComponent)
private
{ Private declarations }
FContentType:string;
FUserName:string;
FPassWord:string;
FBBSName:string;
FBBSUrl:string;
FPostUrl:string;
FPostBody:string;
FHTTPBody:string;
FPostState:integer;
FStartPost:boolean;
FStartGet:boolean;
FStartPostThread:TPostMsgThread;
procedure ThreadDone(Sender: TObject);
procedure setStartPost(Value:boolean);
procedure setStartGet(Value:boolean);
public
{ Public declarations }
procedure Abort;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property ContentType:string read FContentType write FContentType;
property UserName:string read FUserName write FUserName;
property PassWord:string read FPassWord write FPassWord;
property BBSName:string read FBBSName write FBBSName;
property BBSUrl:string read FBBSUrl write FBBSUrl;
property PostUrl:string read FPostUrl write FPostUrl;
property PostBody:string read FPostBody write FPostBody;
property HTTPBody:string read FHTTPBody;
property PostState:integer read FPostState;
property StartPost:boolean read FStartPost write setStartPost;
property StartGet:boolean read FStartGet write setStartGet;
end;
implementation
{ Important: Methods and properties of objects in VCL can only be used in a
method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure SendmailThread.Upd