如何在 QB64 中捕获 Control-Alt-Delete
How To Trap Control-Alt-Delete In QB64
我在 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
我想知道是否有办法在 QB64 中捕获 Control-Alt-Delete。
此片段描述了 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)
我在 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
我想知道是否有办法在 QB64 中捕获 Control-Alt-Delete。
此片段描述了 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)