common user$
user$=""
'*********************************************************
' GET STRING FROM KEY OR SCAN
'*********************************************************
Function fGetkey$(Max%,strType$)
s$=""
While 1
Key$=Input$(1)
Beep ,,,0
Select Key$
Case Chr$(27) 'ESC
fGetkey$=Chr$(27)
Exit Function
Case Chr$(13) 'ENTER
If s$<>"" Then
fGetkey$=s$
Exit Function
End If
Case Chr$(8) 'BACKSPACEE
If Len(s$) Then
Print Chr$(8);
s$=Left$(s$,Len(s$)-1)
End If
If Len(s$)=0 Then
fGetkey$=Chr$(28)
Exit Function
End If
Case Chr$(24) 'CANCEL
While Len(s$)
Print chr$(8); 'CHR$(24) WILL CLEAR ALL
s$=Left$(s$,Len(s$)-1)
Wend
fGetkey$=CHR$(28)
Exit Function
Case Chr$(65)
If cur%=0 Or cur%=1 Or cur%=5 Then
fGetkey$=Chr$(65)
Exit Function
End If
Case Chr$(68)
If strType$<>"" And ModiQTY%=1 Then
'Call sbModify$(strType$,"")
fGetkey$=CHR$(68)
Exit Function
End If
Case Else 'OTHER
If Len(s$) Print Key$;
s$=s$+Key$
End If
End Select
Wend
End Function
Function fGetstring$(Max%,scan$,strType$)
sc$=scan$
While 1
If sc$="1" Then 'SCAN
Open "BAR:" as #16 CODE "A","M","N","I","K","L","H"
Wait 0, 3 'Wait SCAN PORT
If Loc(#16) Then
Beep
s$=Input$(Max%,16)
fGetstring$=s$
Print s$;
Close #16
Exit Function
Else
Close #16
sc$="0" 'SCAN FILE FAIL,READ KEY
End If
End If
If sc$="0" Then 'KEYBOARD
s$=fGetKey$(Max%,strType$)
If s$<>Chr$(28) Then
fGetstring$=s$
Exit Function
Else
sc$=scan$
End If
End If
Wend
End Function
'*************************************
' SignIn 登录界面
'*************************************
Sub SignIn
cls
screen 1,0
locate 3,3 :print "用户名 : "
locate 13,3:sId$=fGetstring$(2,"0","")
locate 3,5 :print "密 码 : "
locate 13,5:sPassWord$=fGetstring$(6,"0","")
print
print "ENT 登录 M1取消"
sPsWd$=Left$(sPassWord$+" ",6)
If sId$="06" Then
If sPsWd$="123456" Then
user$="06"
End If
End If
'Open "A:signin.Txt" As #6
'field #6,2 as id$,6 as password$
'close #6
If user$="" Then
call SignIn
Else
while 1
screen 1,0
Print "Function is OK !"
print
Print "按任意键退出"
wait 0,1
k$=Input$(1)
Exit Sub
Wend
End If
End Sub
'*****************************
' main
'*****************************
MAIN:
Cls
Out &H6080,1 '0:standard-size; 1:the small-size
call SignIn
ERRCOMM:
Cls
Beep 8
'Print "操作错误:"
'Print
'Print "按任意键退出";
'Wait 0,1
'k$=Input$(1)
End
阅读(1601) | 评论(0) | 转发(0) |