G4C

; This is a LOCK for your amiga.

; All it does is to put up a full screen borderless window, which will
; not close untill you give the correct pass code.


WINBIG    0 0 0 0 ""        ; a window at 0,0, screen wide & high
WinType 000010              ; borderless window, with no gadgets
WinBackground SOLID 3 0     

CTEXT 200 220 "Authorised Personel Only" times.font 24 2 3 000

xONLOAD
setscreen dir.lock $lv_fmscreen
lk_var  = ""                ; We clear the code variable
lk_flag = 0
GuiOpen dir.lock            ; and open the gui upon loading.

xOnOpen
setgad dir.lock 1 ON

xONQUIT
delvar lk_#?                ; On quitting we delete the variables

; We declare the following xONKEY events, so that we disable the standard
; window shortcuts (with which the lock could be bypassed).

xONKEY #3       ; Control C  - Close window
xONKEY #2       ; Control B  - Window to back
xONKEY #5       ; Control E  - Edit window
xONKEY #10      ; Control J  - Jump screen
xONKEY #18      ; Control R  - Reload
xONKEY #14      ; Control N  - Next Window
xONKEY #17      ; Control Q  - Quit Window
xONKEY #23      ; Control W  - Window size adjustment
xONKEY #26      ; Control Z  - Zoom Window
xONKEY #19      ; Control S  - Status

xONInactive
guiwindow dir.lock FRONT
guiscreen dir.lock FRONT

Text       200 60 240 14 "Input pass code wanted:" 100 NOBOX
gadid 2

xTextIn    200 75 240 18 "" lk_var "" 100
gadid 1
if $lk_flag = 0                     ; First time - get pass code
   lk_flag = 1
   lk_code = $lk_var
   update dir.lock 2 "Input correct pass code:" 
   update dir.lock 1 ""
   setgad dir.lock 1 ON
else
   if $lk_var = $lk_code            ; quit if correct.
      GUIQUIT dir.lock
   else
      update dir.lock 2 "Wrong Code !!"
      lk_var = ""                   ; Clear the variable for an other try.
      update dir.lock 1 ""
      setgad dir.lock 1 ON
   endif
endif


