Event trapping

 BBS: Inland Empire Archive
Date: 05-28-92 (11:27)             Number: 185
From: MARK BUTLER                  Refer#: NONE
  To: PHIL HODGES                   Recvd: NO  
Subj: Event trapping                 Conf: (2) Quik_Bas
 On 05-25-92 Phil Hodges wrote to Zack Jones...

 PH>    Here's how I do CTRL-BRK, just in case anyone's interested...
 PH>
 PH>    DIM OldBrk%(4)
 PH>    DEF SEG = 0
 PH>     FOR B = &H6C TO &H6F
 PH>      OldBrk%(I-&H6C) = PEEK (B)
                  ^
 what is the value of "I"?

 PH>     NEXT
 PH>    POKE &H6C, &H53
 PH>    POKE &H6D, &HFF
 PH>    POKE &H6E, &H0
 PH>    POKE &H6F, &HF0
 PH>    DEF SEG
 PH>    ' to restore
 PH>    DEF SEG = 0
 PH>     FOR B = &H6C TO &H6F
 PH>      POKE B, OldBrk%(I-&H6C)
                          ^
 I assume the value of "I" is the same here to?

 PH>     NEXT B

 I didn't see the rest of this thread but I took interest in the above
 code ...but... couldn't get it to work, at least not in the
 environment it doesn't. Especially without knowing what "I" equals.

 Anyway... I don't have any other routine for disabling ctrl-brk so
 what's the fix for the above code? (ya really got my interest now)
 Like I say, I didn't see the rest of the thread so I don't know if
 you are looking for some other approach but a ctrl-alt-del trap is
 not hard using KEY trapping. Try this demo out...

 -----------------------8< CUT HERE 8<--------------------------------
    KEY 16, CHR$(12) + CHR$(83)     '***** trap for ctrl-alt-del keys
    ON KEY(16) GOSUB NoReboot
    KEY(16) ON

    CLS                            '*** a little crap-code program
    LOCATE 2, 24                   '*** to demo our NoReboot trap
    PRINT "This simulates a running program"
    LOCATE 3, 15
    PRINT "Press CTRL-ALT-DEL to test the trap or ESC to quit"
    LOCATE 5, 35
    row% = CSRLIN
    col% = POS(0)
    count% = 0
    DO WHILE INKEY$ <> CHR$(27)
        LOCATE row%, col%
        PRINT count%
        count% = count% + 1
    LOOP
    LOCATE row%, col% - 5
    PRINT "T-T-That's all folks!"
    END

NoReboot:                          '*** on ctrl-alt-del we jump here
    BEEP                           '*** then return
    LOCATE 12, 13
    PRINT "No way, ya can't break out of this program THAT easy!"
    SLEEP 2
    LOCATE 12, 1
    PRINT SPACE$(80);
    RETURN
 -----------------------8< CUT HERE 8<--------------------------------


 Hope this helps ya out...


 -------------> MHB :-)

... OFFLINE 1.36 * Vote --> "Deport all of the above" in `92
--- DB B1069/001271
 * Origin: * Bare Bones BBS * (1:105/360)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET