Delphi Inputbox 输入时显示*号


本文整理自网络,侵删。

 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

const InputboxMessage = WM_USER + 200;   //定义消息

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
  procedure InputboxPassword(var MSG: TMessage); message InputBoxMessage;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  PostMessage(Handle,InputboxMessage,0,0);             //发送消息
  inputbox('a','b','ssss')
end;

procedure TForm1.InputboxPassword(var MSG: TMessage);
var
  InputForm,Hedit: THandle;
begin
  InputForm:= Screen.Forms[0].Handle;
  if InputForm <> 0 then
  begin
  Hedit:= FindWindowEx(InputForm,0,'Tedit',nil);
  SendMessage(Hedit,EM_SETPASSWORDCHAR,Ord('*'),0);
end;

end;

end.

例:
procedure TForm2.Image1DblClick(Sender: TObject);
begin
    PostMessage(Handle,InputboxMessage,0,0);
  if (inputbox('授权','请输入授权码','')='5avip.net') then
     Label5.Visible :=true
   else
   begin
     exit;
     Application.Terminate;
   end;
end;

相关阅读 >>

Delphi image 等比例缩小

Delphi 正则表达式的匹配模式

Delphi 过滤所有空格的函数

Delphi tchart 的使用

Delphi ado 连接mssql数据库

Delphi xe7上启用android蓝牙

Delphi 数字分隔

Delphi消息发送字符串

Delphi idhttp友好错误信息的捕获

Delphixe4 版本中,已针对移动平台 引入了 arc 模型

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    暂无评论...