delphi InputQuery 的高级用法:密码修改窗口  
官方Delphi 学习QQ群: 682628230(三千人)
频道

delphi InputQuery 的高级用法:密码修改窗口


tulater_202151181857.png


unit Unit1;


interface


uses

  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,

  Vcl.Controls, Vcl.Forms, Vcl.Dialogs;


type

  TForm1 = class(TForm)

    procedure FormCreate(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;


var

  Form1: TForm1;

implementation


{$R *.dfm}


procedure ShowErrorMsg(Amsg:string);

begin

  Application.MessageBox(PChar(Amsg), 'error', MB_OK);

  abort;

end;



procedure TForm1.FormCreate(Sender: TObject);

var

  ss:array of string;

begin

  SetLength(ss,3);

  if InputQuery('密码修改',[Chr(0)+'旧 密 码',Chr(0)+'新 密 码',Chr(0)+'确认密码'],ss,

    function (const Values: array of string): Boolean

    begin

      Result := False;

      if Values[0]<>'123' then ShowErrorMsg('旧密码不正确');

      if Values[1]<>Values[2] then ShowErrorMsg('两次密码不同');

      Result := True;

     end)

  then begin

    ShowMessage('请牢记您的新密码:'+SS[1]);

  end;


end;

end.


转自:https://blog.csdn.net/aroc_lo/article/details/116309646


推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 0.034308910369873 seconds