home *** CD-ROM | disk | FTP | other *** search
- '─ Area: F-QUICKBASIC ─────────────────────────────────────────────────────────
- ' Msg#: 378 Date: 11 Apr 94 23:56:11
- ' From: John Waalkes Read: Yes Replied: No
- ' To: All Mark:
- ' Subj: AltKey 1/2
- '──────────────────────────────────────────────────────────────────────────────
- 'Here's something I cooked up to toggle the menu bar ala Micro$oft.
-
-
- REM ALTKEY.BAS Toggle the menu bar ala Micro$oft.
- REM Runs on QB, PDS, PB?
- REM Don't forget to run QB with the /l switch.
- ' With PB, you need to redo all register and interrupt stuff
- REM QBasic owners need not apply (although it wouldn't be hard to modify
- REM for use with PEEK's).
-
- REM It's yours now...
-
- DECLARE SUB NormBar ()
- DECLARE SUB PressDown ()
- DECLARE SUB Release1 ()
- DECLARE SUB Release2 ()
- TYPE RegType
- AX AS INTEGER
- BX AS INTEGER
- CX AS INTEGER
- DX AS INTEGER
- BP AS INTEGER
- SI AS INTEGER
- DI AS INTEGER
- FLAGS AS INTEGER
- END TYPE
-
- DIM InputRegs AS RegType, OutputRegs AS RegType
-
- CONST TRUE = -1
- CONST FALSE = 0
-
- CONST White = 7
- CONST Black = 0
- CONST BrtWhite = 15
-
- CLS
-
- REM Setup menu bar
- CALL NormBar
-
- DO
- Choice$ = INKEY$
- IF Choice$ = "" THEN
-
- REM Get the ALT key status. Set AH = &H02, BIOS Call &H16
-
- InputRegs.AX = &H200
- CALL INTERRUPT(&H16, InputRegs, OutputRegs)
-
- REM Mask Bit in AL
-
- IF OutputRegs.AX AND 8 THEN
- AltKey = TRUE
- ELSE
- REM Look to see if we're at the 2nd release
-
- IF AltKey = TRUE THEN
- IF LeadingEdge = TRUE AND BarOn = FALSE THEN
- CALL NormBar
- END IF
- END IF
- AltKey = FALSE
- END IF
-
- REM Is the ALT key pressed?
-
- IF AltKey = TRUE THEN
-
- REM LeadingEdge is used to keep BarOn from toggling every loop
- REM Use it to tell when the menu bar is active.
-
- IF LeadingEdge = FALSE THEN
- IF BarOn = FALSE THEN
- BarOn = TRUE
- LeadingEdge = TRUE
- ELSE
- BarOn = FALSE
- LeadingEdge = TRUE
- END IF
- END IF
- ELSE
-
- REM Reset LeadingEdge
-
- LeadingEdge = FALSE
- END IF
- END IF
-
- REM First ALT pressdown. Second doesn't do anything.
-
- IF LeadingEdge = TRUE AND BarOn = TRUE THEN
- CALL PressDown
- END IF
- REM First ALT release
-
- IF LeadingEdge = FALSE AND BarOn = TRUE THEN
- CALL Release1
- END IF
-
- REM Status Stuff.
-
- COLOR White, Black
- LOCATE 2, 1
- PRINT SPACE$(80)
- PRINT "AltKey", AltKey
- PRINT "LeadingEdge", LeadingEdge
- PRINT "BarOn", BarOn;
-
- LOOP WHILE Choice$ = ""
-
- REM Normal Menu bar
- SUB NormBar
-
- LOCATE 1, 1
- COLOR Black, White
- PRINT SPACE$(80)
-
- LOCATE 1, 3
- PRINT "File";
-
- END SUB
-
- REM First Pressdown. Highlight the 'F'
- SUB PressDown
-
- LOCATE 1, 3
-
- COLOR BrtWhite, White
- PRINT "F";
-
- COLOR Black, White
- PRINT "ile";
-
- END SUB
-
- REM First release. Highlight the 'F' and blackout the rest
- SUB Release1
-
- LOCATE 1, 2
-
- COLOR BrtWhite, Black
- PRINT " F";
-
- COLOR White, Black
- PRINT "ile ";
-
- END SUB
-