最常用的不就是下面几个嘛,没必要为此太劳心吧?
function ShowAsk(ahWnd: THandle;
asInfo: string): Integer;
function ShowAsk3(ahWnd: HWND;
asInfo: string): Integer;
procedure ShowInfo(ahWnd: THandle;
asInfo: string);
procedure ShowError(ahWnd: THandle;
asInfo: string);
procedure ShowInEdit(const asCaption, asInfo: string);
function Input(const asCaption: string;
var asInput: string): Boolean;
function InputIP(var asIP: string): Boolean;
procedure ShowInfo(ahWnd: THandle;
asInfo: string);
begin
MessageBox(ahWnd, PChar(asInfo), '提示', MB_ICONINFORMATION + MB_OK);
end;
procedure ShowError(ahWnd: THandle;
asInfo: string);
begin
MessageBox(ahWnd, PChar(asInfo), '错误', MB_ICONERROR + MB_OK);
end;
function ShowAsk(ahWnd: THandle;
asInfo: string): Integer;
begin
Result := MessageBox(ahWnd, PChar(asInfo), '提示', MB_ICONQUESTION + MB_YESNO + MB_DEFBUTTON2);
end;
function ShowAsk3(ahWnd: HWND;
asInfo: string): Integer;
begin
Result := MessageBox(ahWnd, PChar(asInfo), '提示', MB_ICONQUESTION + MB_YESNOCANCEL + MB_DEFBUTTON1);
end;
procedure ShowInEdit(const asCaption, asInfo: string);
var
edtInput: TEdit;
frmDlg: TForm;
begin
frmDlg := CreateMessageDialog(asCaption, mtInformation, [mbOK]);
with frmDlgdo
try
Caption := Application.Title;
Width := 280;
Height := 120;
edtInput := TEdit.Create(frmDlg);
with edtInputdo
begin
Parent := frmDlg;
Left := 56;
Top := 32;
Width := 180;
Height := 23;
TabOrder := 1;
Text := asInfo;
ReadOnly := True;
Color := clBtnFace;
end;
with TButton(Components[2])do
begin
Caption := '确定';
Width := 80;
Left := 100;
TabOrder := 2;
end;
ShowModal;
finally
Free;
end;
end;