?
Solved

****** and not characters into password TEdit

Posted on 2011-02-23
2
Medium Priority
?
662 Views
Last Modified: 2012-05-11
I have two code from.  Pleas put them together so when i will type character into password TEdit
"**********" will come out?
// *******************  pasword
procedure TForm2.InputBoxSetPasswordChar(var Msg: TMessage);
var
  hInputForm, hEdit, hButton: HWND;
 begin
  hInputForm := Screen.Forms[0].Handle;
  if (hInputForm <> 0) then
  begin
    hEdit := FindWindowEx(hInputForm, 0, 'TEdit', nil);
               // Change button text:
      hButton := FindWindowEx(hInputForm, 0, 'TButton', nil);
      SendMessage(hButton, WM_SETTEXT, 0, Integer(PChar('Cancel')));
      SendMessage(hEdit, EM_SETPASSWORDCHAR, Ord('*'), 0);
  end;
end;

Open in new window

unit password;

interface

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

type
  TForm3 = class(TForm)
    Login: TEdit;
    password: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    OKBtn: TButton;
    CancelBtn: TButton;
    procedure CancelBtnClick(Sender: TObject);
    procedure OKBtnClick(Sender: TObject);
       function CheckPassword: Boolean;
    procedure FormCreate(Sender: TObject);

  private
    { Private declarations }
  public


    { Public declarations }
  end;

var
  Form3: TForm3;
  passwordtext:string;
  i:integer=1;
implementation

uses machine, mirna10;


{$R *.dfm}

type
  TUserID = record
    Login: string;
    Password: string;
  end;

const
  CUserID: array[0..4] of TUserID = (
    (Login: 'i'; Password: '1'),
    (Login: 'iv'; Password: '2'),
    (Login: 'iva'; Password: '3'),
    (Login: 'ivan'; Password: '4'),
    (Login: 'ivang'; Password: '5')
  );

function TForm3.CheckPassword: Boolean;
var
  PasswordDlg: Tform3;
begin
  PasswordDlg := Tform3.Create(Application);
  try
    Result := PasswordDlg.ShowModal = mrOk;
  finally
    FreeAndNil(PasswordDlg);
  end;
end;




procedure TForm3.FormCreate(Sender: TObject);
begin

end;

procedure Tform3.OKBtnClick(Sender: TObject);
var
  I: Integer;
  ID: TUserID;
begin
  ModalResult := mrNone;
  for I := 0 to Length(CUserID) - 1 do
  begin
    if (UpperCase(Login.Text) = UpperCase(CUserID[I].Login)) and
       (Password.Text = CUserID[I].Password) then
    begin
    Form1.Timer1.Enabled:=true;
           ModalResult := mrOk;
        //passwordtext:=login.Text;
           loginmy:=  login.Text;
           okpassword:=true;
           form1.timer1.Enabled:=true;
            Str := DateTimeToStr(Now)+'  '+ loginmy;  // aloud writing procedure
    end;
  end;
  if ModalResult <> mrOk then
    MessageBox(Handle, 'Invalid user name or password!', 'Login', MB_OK);
end;


procedure Tform3.CancelBtnClick(Sender: TObject);
begin
  ModalResult := mrCancel;
end;

end.

Open in new window

0
Comment
Question by:pr2501
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya earned 2000 total points
ID: 34963697
You dont need to do it from code, set it from the TEdit properties
Password-Character.PNG
0
 

Author Comment

by:pr2501
ID: 34964216
thank you
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question