CTRL-A Capture Example

More advanced topics discussed.

Moderators: Susan Smith, admin, Gabriel

Post Reply
Posts: 287
Joined: Fri Jun 19, 2009 9:01 am
Location: Lawrence, Kansas

CTRL-A Capture Example

Post by bluesfannoz »

For those who attended the conference. Here is an example of our code we mentioned that traps when users press CTRL-A

Via a KEYBOARD statement if translates CTRL-A into CTRL-AGO CTRL_C<Return> So if you have a Subroutine labeled CTRL_C in your running program it executes that code.

They prompted with a *** [RETURN] for Main Menu *** message. You can press a lower case 'i' and it will take you to command prompt. You could add a password if you want. We chose not too.

Code: Select all

00010     Dim CHN$*50
00030     Execute "Config KEYBOARD 0001,00010067006F0020004300540052004C005F0043000D" ! cntrl - a sends go ctrl_c to command prompt
00050     Print NEWPAGE
00070 RPTR: Print Fields "10,1,C": "Example of our CTRL-A Capture routine:"
00090     Print Fields "12,1,C": "You can press a lower case 'i' when prompted to Return for Main Menu and it will pause the program"
00110     Input Fields "15,1,C": A$
00130     Goto RPTR
00150 CTRL_C: Let CHN$="ctrlacap" : Print CHR$(7); ! change to program you want
00170     If KST1>2 Then Goto P_GO
00190     Let KST1=KST1+1
00210     Print #WIN, Fields "24,1,C,N/W:T": BL$
00230     Print #WIN, Fields "24,6,C,R": " *** [RETURN] for Main Menu *** "
00250     Let KST$=KSTAT$(1)
00270     Let KST=ORD(KST$) : If KST=13 Then Chain CHN$
00290     If KST<>105 AND KST<>73 AND KST<>9 Then Goto CTRL_C
00310     Print Fields "22,1,C" : "You are allowed command prompt access" : Pause
00330 ERR_T1: !
00350 P_GO: Print #WIN, Fields "24,1,C,N/W:T": BL$
00370     Print #WIN, Fields "24,6,C,N/W:T;24,11,C,R": "Type "," GO "
00390     Print #WIN, Fields "24,16,C,N/W:T": "to Return to Main Menu"
00410 I_GO: Input #WIN, Fields "24,40,C 2,S:T[Y]": GZ$ : Let GZ$=UPRC$(GZ$)
00430     If GZ$(1:1)="G" Then Chain CHN$
00450     Goto I_GO
Steve Koger
Computer Specialist
Post Reply