这个容易的很,我给你一例子
unit LoginFrm;interfaceuses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons, ExtCtrls;type
  TLoginForm = class(TForm)
    lblEnterPassword: TLabel;
    lblEnterName: TLabel;
    edtName: TEdit;
    edtPassword: TEdit;
    btnOK: TButton;
    btnCancel: TButton;
  public
  end;function GetLoginParams(ALoginParams: TStrings): Boolean;implementation{$R *.DFM}function GetLoginParams(ALoginParams: TStrings): Boolean;
var
  LoginForm: TLoginForm;
begin
  Result := False;
  LoginForm := TLoginForm.Create(Application);
  try
    if LoginForm.ShowModal = mrOk then
    begin
      ALoginParams.Values['USER NAME'] := LoginForm.edtName.Text;
      ALoginParams.Values['PASSWORD'] := LoginForm.edtPassWord.Text;
      Result := True;
    end;
  finally
    LoginForm.Free;
  end;
end;end.

解决方案 »

  1.   

    应该没有吧你可以用InputQuery、InputBox,然后FindWindow然后发EM_SETPASSWORDCHAR消息
    ....会很烦....界面也不好看....
      

  2.   

    //密码输入框
    function InputPassWord(const ACaption, APrompt:String;
      var Value: String): Boolean;
      function GetAveCharSize(Canvas: TCanvas): TPoint;
      var
        I: Integer;
        Buffer: array[0..51] of Char;
      begin
        for I := 0 to 25 do Buffer[I] := Chr(I + Ord('A'));
        for I := 0 to 25 do Buffer[I + 26] := Chr(I + Ord('a'));
        GetTextExtentPoint(Canvas.Handle, Buffer, 52, TSize(Result));
        Result.X := Result.X div 52;
      end;
    var
      Form: TForm;
      Prompt: TLabel;
      Edit: TEdit;
      DialogUnits: TPoint;
      ButtonTop, ButtonWidth, ButtonHeight: Integer;
    begin
      Result := False;
      Form := TForm.Create(Application);
      with Form do
        try
          Canvas.Font := Font;
          DialogUnits := GetAveCharSize(Canvas);
          BorderStyle := bsDialog;
          Caption := ACaption;
          ClientWidth := MulDiv(180, DialogUnits.X, 4);
          ClientHeight := MulDiv(63, DialogUnits.Y, 8);
          Position := poScreenCenter;
          Prompt := TLabel.Create(Form);
          with Prompt do
          begin
            Parent := Form;
            AutoSize := True;
            Left := MulDiv(8, DialogUnits.X, 4);
            Top := MulDiv(8, DialogUnits.Y, 8);
            Font.Name:='宋体';
            Font.Size:=9;
            Caption := APrompt;
          end;
          Edit := TEdit.Create(Form);
          with Edit do
          begin
            Parent := Form;
            Left := Prompt.Left;
            Top := MulDiv(19, DialogUnits.Y, 8);
            Width := MulDiv(164, DialogUnits.X, 4);
            PassWordChar:='*';
            Font.Name:='宋体';
            Font.Size:=12;
            MaxLength := 20;
            Text := Value;
            Clear;
          end;
          ButtonTop := MulDiv(41, DialogUnits.Y, 8);
          ButtonWidth := MulDiv(50, DialogUnits.X, 4);
          ButtonHeight := MulDiv(14, DialogUnits.Y, 8);
          with TButton.Create(Form) do
          begin
            Parent := Form;
            Font.Name:='宋体';
            Font.Size:=9;
            Caption :='确 定';//SMsgDlgOK;
            ModalResult := mrOk;
            Default := True;
            SetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth,
              ButtonHeight);
          end;
          with TButton.Create(Form) do
          begin
            Parent := Form;
            Font.Name:='宋体';
            Font.Size:=9;
            Caption :='取 消';//SMsgDlgCancel;
            ModalResult := mrCancel;
            Cancel := True;
            SetBounds(MulDiv(92, DialogUnits.X, 4), ButtonTop, ButtonWidth,
              ButtonHeight);
          end;
          if ShowModal = mrOk then
          begin
            Value := Edit.Text;
            Result := True;
          end;
        finally
          Form.Free;
        end;
    end;
      

  3.   

    天呐!我直接使用一个PASSWORDDLG,我都嫌麻烦!我还…………
    这个问题不是要怎么实现密码输入,而是想找一个API函数,显示密码对话框的,就象InputQuery 、InputBox之类的!
    应该有!大家有谁知道?!
      

  4.   

    to z_x_b(长弓落日金沙丘) :你自己去看看Delphi VCL(Dialogs.pas)中 InputQuery 、InputBox的源程序,怎么实现的,
    我的
    //密码输入框
    function InputPassWord(const ACaption, APrompt:String;
      var Value: String): Boolean;是根据它们写出来的,呵呵^^
    顺便,把VCL源程序中InputQuery 、InputBox的定义贴出来,你可以比较一下啊^^://////////////////////////////////////////////////////////////////////
    { Input dialog }function InputQuery(const ACaption, APrompt: string;
      var Value: string): Boolean;
    var
      Form: TForm;
      Prompt: TLabel;
      Edit: TEdit;
      DialogUnits: TPoint;
      ButtonTop, ButtonWidth, ButtonHeight: Integer;
    begin
      Result := False;
      Form := TForm.Create(Application);
      with Form do
        try
          Canvas.Font := Font;
          DialogUnits := GetAveCharSize(Canvas);
          BorderStyle := bsDialog;
          Caption := ACaption;
          ClientWidth := MulDiv(180, DialogUnits.X, 4);
          ClientHeight := MulDiv(63, DialogUnits.Y, 8);
          Position := poScreenCenter;
          Prompt := TLabel.Create(Form);
          with Prompt do
          begin
            Parent := Form;
            AutoSize := True;
            Left := MulDiv(8, DialogUnits.X, 4);
            Top := MulDiv(8, DialogUnits.Y, 8);
            Caption := APrompt;
          end;
          Edit := TEdit.Create(Form);
          with Edit do
          begin
            Parent := Form;
            Left := Prompt.Left;
            Top := MulDiv(19, DialogUnits.Y, 8);
            Width := MulDiv(164, DialogUnits.X, 4);
            MaxLength := 255;
            Text := Value;
            SelectAll;
          end;
          ButtonTop := MulDiv(41, DialogUnits.Y, 8);
          ButtonWidth := MulDiv(50, DialogUnits.X, 4);
          ButtonHeight := MulDiv(14, DialogUnits.Y, 8);
          with TButton.Create(Form) do
          begin
            Parent := Form;
            Caption := SMsgDlgOK;
            ModalResult := mrOk;
            Default := True;
            SetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth,
              ButtonHeight);
          end;
          with TButton.Create(Form) do
          begin
            Parent := Form;
            Caption := SMsgDlgCancel;
            ModalResult := mrCancel;
            Cancel := True;
            SetBounds(MulDiv(92, DialogUnits.X, 4), ButtonTop, ButtonWidth,
              ButtonHeight);
          end;
          if ShowModal = mrOk then
          begin
            Value := Edit.Text;
            Result := True;
          end;
        finally
          Form.Free;
        end;
    end;function InputBox(const ACaption, APrompt, ADefault: string): string;
    begin
      Result := ADefault;
      InputQuery(ACaption, APrompt, Result);
    end;
      
     
      

  5.   

    修改DELPHI 的inputBox函数就可以了