Input.pas
资源名称:计算机远程监控.rar [点击查看]
上传用户:rickyhu
上传日期:2007-05-27
资源大小:842k
文件大小:2k
源码类别:
控制台编程
开发平台:
Delphi
- unit Input;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls;
- type
- TInputForm = class(TForm)
- EditInput: TEdit;
- BtnOk: TButton;
- BtnCancel: TButton;
- LabelNotice: TLabel;
- procedure BtnCancelClick(Sender: TObject);
- procedure BtnOkClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- InputForm: TInputForm;
- implementation
- {$R *.dfm}
- procedure TInputForm.BtnCancelClick(Sender: TObject);
- begin
- Close;
- EditInput.Text:='';
- end;
- procedure TInputForm.BtnOkClick(Sender: TObject);
- var
- StrName:PAnsiChar;
- begin
- if(Editinput.Text='') then
- begin
- LabelNotice.Caption:='输入不能为空!';
- EditInput.SetFocus;
- exit;
- end;
- StrName:=PAnsiChar(EditInput.Text);
- if(Self.Caption<>'发送消息') then
- begin
- if(StrPos(StrName,'')<>nil) or (StrPos(StrName,'/')<>nil) or
- (StrPos(StrName,':')<>nil) or (StrPos(StrName,'*')<>nil) or
- (StrPos(StrName,'?')<>nil) or (StrPos(StrName,'"')<>nil) or
- (StrPos(StrName,'<')<>nil) or (StrPos(StrName,'>')<>nil) or
- (StrPos(StrName,'|')<>nil) then
- begin
- LabelNotice.Caption:='输入字符串不能含有以下字符: / : * ? " < > |';
- EditInput.SetFocus;
- exit;
- end;
- end
- else if(StrPos(StrName,'|')<>nil) then
- begin
- LabelNotice.Caption:='输入字符串不能含有以下字:|';
- EditInput.SetFocus;
- exit;
- end;
- Close;
- end;
- end.