HoldNuke.pas
上传用户:hbtcygglw
上传日期:2007-01-07
资源大小:281k
文件大小:2k
- unit HoldNuke;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, Buttons, Spin, ComCtrls;
- type
- THoldNukeDlg = class(TForm)
- Label1: TLabel;
- edTargetID: TEdit;
- Label2: TLabel;
- Label8: TLabel;
- edSendNum: TSpinEdit;
- edMsg: TEdit;
- btnOk: TBitBtn;
- btnCancel: TBitBtn;
- Label3: TLabel;
- NukeBar: TProgressBar;
- procedure btnOkClick(Sender: TObject);
- private
- { Private declarations }
- function PadNukeMsg(msg:string;len:Integer):string;
- public
- { Public declarations }
- class function Execute(strTargetId,strMsg:string;nLookCnt:Integer):Boolean;
- end;
- implementation
- {$R *.DFM}
- { THoldNukeDlg }
- uses main,data;
- class function THoldNukeDlg.Execute(strTargetId, strMsg: string;
- nLookCnt: Integer): Boolean;
- begin
- with THoldNukeDlg.Create(Application) do
- begin
- Result:=(ShowModal=mrOk);
- Free;
- end;
- end;
- procedure THoldNukeDlg.btnOkClick(Sender: TObject);
- var
- NukeMsg:string;
- i:Integer;
- begin
- NukeMsg:=PadNukeMsg(edMsg.Text,1200);
- if(edSendNum.Value<=50)then
- begin
- NukeBar.Max:=edSendNum.Value;
- NukeBar.Step:=1;
- NukeBar.Position:=0;
- end
- else if((edSendNum.Value>50) and (edSendNum.Value<=500))then
- begin
- NukeBar.Max:=edSendNum.Value;
- NukeBar.Step:=10;
- NukeBar.Position:=0;
- end
- else if((edSendNum.Value>500) and (edSendNum.Value<10000))then
- begin
- NukeBar.Max:=edSendNum.Value;
- NukeBar.Step:=50;
- NukeBar.Position:=0;
- end
- else begin
- NukeBar.Max:=edSendNum.Value;
- NukeBar.Step:=100;
- NukeBar.Position:=0;
- end;
- for i:=0 to edSendNum.Value do
- begin
- MainForm.SendMsg(edTargetId.Text,NukeMsg);
- if((i mod Nukebar.Step)=1)then NukeBar.StepIt;
- Application.ProcessMessages;
- Sleep(50);
- end;
- NukeBar.Position:=NukeBar.Max;
- end;
- function THoldNukeDlg.PadNukeMsg(msg: string;len:Integer): string;
- var
- i,l:Integer;
- begin
- l:=Length(msg);
- Result:='';
- if(l<len)then
- begin
- for i:=0 to (len div l) do
- begin
- Result:=Result+msg;
- end;
- end
- else Result:=msg;
- end;
- end.