zoukankan      html  css  js  c++  java
  • 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('授权','请输入授权码','')='baidu.com') then
         Label5.Visible :=true
       else
       begin
         exit;
         Application.Terminate;
       end;
    end;
  • 相关阅读:
    webmagic使用
    网站文件下载链接
    正则表达式
    JS 页面刷新或重载
    History
    【问题&解决】fonts/fontawesome-webfont.woff2 404 (Not Found)
    ckeditor的使用
    Windows Server 2012 R2 或 2016 无法安装 .Net 3.5.1
    自定义配置文件的读取
    MVC中上传文件大小限制的解决办法
  • 原文地址:https://www.cnblogs.com/huasoft/p/13253678.html
Copyright © 2011-2022 走看看