Microsoft KB Archive/96368

= How to Encrypt a Program with a Password =

PSS ID Number: 96368

Article Last Modified on 10/22/1999

-

The information in this article applies to:


 * Microsoft FoxBASE+ for Macintosh 2.01

-



This article was previously published under Q96368



SUMMARY
Password protection can be included with an application. The following code snippet is an example of a password routine that displays a &quot; * &quot; in place of the characters being typed. It also gives a time limit of 15 seconds to type in the correct password. The password in this program is &quot;password&quot;.



MORE INFORMATION
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this code &quot;as is&quot; without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. ON ESCAPE SET TALK OFF SCREEN 1 TOP HEADING &quot;Log in&quot; FIXED SIZE 10,50 AT 0,0

PASSWORD = SPACE(10) STARTTIME = VAL(SYS(2)) ENDTIME = STARTTIME + 15

DO WHILE PASSWORD # &quot;password&quot; CLEAR PASSWORD = SPACE(10) PW = SPACE(1) @ 5,13 SAY &quot;Password: &quot; X=1 PW=-1 @ 2,16 SAY &quot;Seconds to type your password.&quot; STARTPOS=23 @ 8,12 SAY &quot;press return when done&quot; DO WHILE PW # 13 .AND. VAL(SYS(2)) < ENDTIME PW=INKEY(.75) IF PW > 32 .AND. PW < 127 @ 5,STARTPOS SAY &quot;*&quot; STARTPOS = STARTPOS+1 PASSWORD = STUFF(PASSWORD,X,1,CHR(PW)) X=X+1 ENDIF @ 2,13 SAY RIGHT(STR(ENDTIME -VAL(SYS(2))),2) ENDDO DO WHILE PASSWORD # &quot;password&quot; IF PASSWORD # &quot;password&quot; ALERT NOTE 1 &quot;Password is incorrect&quot; EXIT ENDIF ENDDO IF PW # 13 ALERT NOTE 1 &quot;Time expired... Log in aborted.&quot; CANCEL ENDIF ENDDO

Additional query words: 2.10 FoxBASE+/Mac

Keywords: KB96368

Technology: kbAudDeveloper kbFoxBASE201Mac kbFoxBASESearch kbFoxproSearch kbHWMAC kbOSMAC

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.