2

我在 QB64 中使用以下代码来捕获 Control-Break:

ON TIMER(1) GOSUB breaktrap
TIMER ON
x = _EXIT ' disable break
DO
    _LIMIT 50
    x$ = INKEY$
LOOP
breaktrap:
v = _EXIT
IF v THEN
    PRINT "*break*"
    SLEEP 5
    SYSTEM
END IF
RETURN

我想知道是否有办法Control-Alt-Delete在 QB64 中进行陷阱。

4

1 回答 1

1

这个片段描述了为什么 Control-Alt-Delete 没有被困住:

CONST KEY_RSHIFT& = 100303
CONST KEY_LSHIFT& = 100304
CONST KEY_RCTRL& = 100305
CONST KEY_LCTRL& = 100306
CONST KEY_RALT& = 100307
CONST KEY_LALT& = 100308
DO
    x = _KEYHIT
    IF x = CVI(CHR$(0) + CHR$(83)) THEN
        IF _KEYDOWN(KEY_RCTRL&) OR _KEYDOWN(KEY_LCTRL&) THEN
            IF _KEYDOWN(KEY_RALT&) OR _KEYDOWN(KEY_LALT&) THEN
                PRINT "KEYHIT: Ctrl-Alt-Delete"
            ELSE
                PRINT "KEYHIT: Ctrl-Delete"
            END IF
        ELSE
            IF _KEYDOWN(KEY_RALT&) OR _KEYDOWN(KEY_LALT&) THEN
                PRINT "KEYHIT: Alt-Delete"
            ELSE
                PRINT "KEYHIT: Delete"
            END IF
        END IF
    END IF
    k$ = INKEY$
LOOP UNTIL k$ = CHR$(27)
于 2016-12-06T04:18:29.050 回答