Microsoft KB Archive/99904

{|
 * width="100%"|

-

The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.5, 2.5a
 * Microsoft FoxPro for MS-DOS, versions 1.02, 2.0, 2.5, 2.5a

-

SUMMARY
To encrypt a password so that is not revealed, you can echo asterisks to the screen instead of the actual characters entered.

MORE INFORMATION
The following sample code accepts a four-letter password and echoes four asterisks to the screen. This code must be executed from within a program, not from the Command window.

  CLEAR CLEAR ALL SET TALK OFF  && Prevents &quot;double&quot; echoing to the screen. STORE &quot;&quot; to x && Initialize memory variable x to character blank. @ 2,2 SAY &quot;&quot;  && Position the password GET field on the screen.

* The following loop sets up the number of characters in the * password. It can be modified to be any length.

FOR y=1 TO 4 z=INKEY(0)    && Initialize Z to integer value of zero. * Add, character by character, each letter of the password typed * in by the user. x=x+CHR(z) * Echo an * to the GET field on the screen for each letter that * the user types in. @ 2,2 SAY REPLICATE(&quot;*&quot;,y) ENDFOR ?X && To display the typed password. The code above can be modified to reflect a longer password or to echo a different character (other than the &quot;*&quot; character) on the GET field of the screen. If this encryption code is organized as a procedure, the memory variables x, y, and z must be declared as PUBLIC if they are passed into and out of the procedure. Additional query words: FoxDos FoxWin

Keywords         : kbcode FxenvMemory Version          : 2.50 2.50a | 1.02 2.00 2.50 2.50 Platform         : MS-DOS WINDOWS Issue type       :
 * }