Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : FX_PWORD.ZIP
Filename : FX_PWORD.PRG
* FX_PWORD.PRG VER. 1 10/03/89 M.S. WINSTON *
* DO INKEY LOOP TO GET PASSWORD CHR-BY-CHR IN *
* FOXPRO IF X COLOR ATTRIBUTE IS INAPPROPRIATE *
***************************************************
*
*--program use: DO FX-PWORD from within a loop which counts the number of
*-- attempts allowed to enter a valid password and does the
*-- appropriate comparison testing & encryption/decryption
*--
*--program advantage: does not use X (blank) color attribute, so user can see
*-- where in the password "field" he is while entering
*--
*--note: assumes row 2 is error message line
*--note: assumes password must consist of 4 alpha (A-Z) characters
*--note: assumes "typeover" (not "insert") mode, w/ destructive backspace
*--note: requires user to
*
*--note: parameters are the coordinates of the "field" and the memvar
*-- which will contain the result
*--note: assumes the memvar for the result has been initialized in the
*-- calling program, as well as SET TALK OFF, etc.
*
PARAMETERS pwordrow,pwordcol,theresult
PRIVATE n, thiskey
*--note: insert appropriate @ SAY statement w/ "prompt wording" here
@ pwordrow,pwordcol SAY "____"
n = 1
DIMENSION thischr(5)
thischr = " "
DO WHILE n <= 5
CLEAR TYPEAHEAD
SET TYPEAHEAD TO 1
thiskey = inkey(0,"H") && hide cursor & wait indefinitely for keystroke
CLEAR TYPEAHEAD
SET TYPEAHEAD TO 0
@ 2,0 && clear any previous error message
DO CASE
CASE thiskey = 13 && return key pressed
IF n < 5
@ 2,0 SAY "Password must be exactly 4 letters long."
@ pwordrow,pwordcol SAY "____"
thischr = " "
n = 1
ELSE && 4-letter password attempt entered
theresult = thischr(1)+thischr(2)+thischr(3)+thischr(4)
EXIT
ENDIF
CASE thiskey = 127 .AND. n > 1 && valid destructive backspace pressed
n = n - 1
@ pwordrow,pwordcol+n-1 SAY "_"
thischr(n) = " "
CASE n < 5 .AND. ((thiskey >= 65 .AND. thiskey <= 90) .OR. ;
(thiskey >= 97 .AND. thiskey <= 122)) && A-Z or a-z pressed
@ pwordrow,pwordcol+n-1 SAY "*"
thischr(n) = UPPER(CHR(thiskey))
n = n + 1
OTHERWISE && some other non-function key pressed
@ 2,0 SAY "That key is not valid now."
ENDCASE
ENDDO && n <= 5
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/