Hide or encode character while user enter password

vyascd81

New Member
Hello,

I have created log in form and I want password field must be encoded like "*" or " " while user enter password.

How can I do this..?

Please help me.

Thanks in advance.

Chirag.
 
There are a few options available and some were outlined in a previous thread - Password masking and tabbing in v9.1d.

Another is to use "SendMessageA" and display "*" for every character typed:
Code:
DEFINE VARIABLE vpassword AS CHARACTER LABEL "Password" NO-UNDO.

ENABLE vpassword BLANK WITH SIDE-LABELS.

RUN SendMessageA (vpassword:HWND,204,ASC("*"),0).

WAIT-FOR RETURN OF vpassword.
ASSIGN vpassword.
MESSAGE "Password entered =" vpassword VIEW-AS ALERT-BOX INFORMATION.

PROCEDURE SendMessageA EXTERNAL "user32":
   DEFINE INPUT PARAMETER hwnd AS LONG.
   DEFINE INPUT PARAMETER umsg AS LONG.
   DEFINE INPUT PARAMETER wparam AS LONG.
   DEFINE INPUT PARAMETER lparam AS LONG.
END.
 
Look up help on PASSWORD-FIELD attribute. If you are on an ancient version which does not have PASSWORD-FIELD you can use BLANK.

Code:
DEF VAR cuser_id AS CHAR LABEL "User".
DEF VAR cpassword AS CHAR LABEL "Password".


DEFINE FRAME fr
   cuser_id  
   cpassword PASSWORD-FIELD /* use BLANK for ancient versions */
WITH SIZE 40 BY 20.


VIEW FRAME fr.
ENABLE ALL WITH FRAME fr.


WAIT-FOR CLOSE OF THIS-PROCEDURE.
 
Back
Top