YOUR JOYFUL MEMBERSHIP CREDENTIALS HAVE NOT BEEN IDENTIFIED. PLEASE ENTER YOUR CREDENTIALS OR JOIN OUR JOYFUL COMMUNITY.
ENTER YOUR JOYFUL MEMBER CREDENTIALS REQUEST ACCESS TO OUR JOYFUL COMMUNITY


Source to trap keys
11-28-2017, 09:59 PM
Post: #1
 (Print Post)
Traps and ignores Print-Screen and Control-Break:

Code Snippet: [Select]
;Traps and ignores Print-Screen and Control-Break. v1.1a PD 1999-2014.

;Compiled with 'Tasm /t Keytrap;'

            .model  medium, basic           ;Stay compatible with basic.
     extrn   SETUEVENT: far
            .code
public      SETINT

SETINT      proc    uses ds
            mov     ax, 351BH               ;Get old Control-Break interrupt
            int     21h                     ;vector and save it.
            mov     word ptr cs:OldVector1,bx
            mov     word ptr cs:OldVector1+2,es
            push    cs                      ;Set the new
            pop     ds                      ;interrupt vector
            lea     dx, EventHandler        ;to the address
            mov     ax, 251BH               ;of our service
            int     21H                     ;routine.

            mov     ax, 3505H               ;Get old Print-Screen interrupt
            int     21h                     ;vector and save it.
            mov     word ptr cs:OldVector2,bx
            mov     word ptr cs:OldVector2+2,es
            push    cs                      ;Set the new
            pop     ds                      ;interrupt vector
            lea     dx, EventHandler        ;to the address
            mov     ax, 2505H               ;of our service
            int     21H                     ;routine.
            ret 
SETINT     endp

public  EVENTHANDLER

EVENTHANDLER    proc
            iret                            ;Eat keystroke.

OldVector1   dd      0                      ;Keep data in code segment.
OldVector2   dd      0

EVENTHANDLER endp

public      RESTINT

RESTINT     proc    uses ds                 ;Restore the old
            lds     dx, cs:OldVector1       ;interrupt vectors
            mov     ax, 251BH               ;so things will
            int     21h                     ;keep working when
            lds     dx, cs:OldVector2       ;this basic program is
            mov     ax, 2505H               ;finished.
            int     21h
            ret
RESTINT     endp
            end

Games: DNDDOOR - https://bit.ly/EriksDNDDoor DUNGEON - https://bit.ly/EriksDungeon
Interpreter - https://bit.ly/EriksSICK Hex Editor - https://bit.ly/EriksHexEditor Utilities - https://bit.ly/EriksUtils

QB45 files: - https://bit.ly/EriksQB45 QB64shell - https://bit.ly/QB64shell Some old QB64 versions: - https://bit.ly/OldQB64 
Find all posts by this user
Like Post



Forum Jump:


User(s) browsing this thread: 1 Guest(s)




QB64 Member Project - OpenGL Triangles
QB64 Member Project - Martin Fractals version four
QB64 Member Project - MAPTRIANGLE
QB64 Member Project - Othello
QB64 Member Project - Color Triangles
QB64 Member Project - Dakapo
QB64 Member Project - Color Rotating Text
QB64 Member Project - Domain
QB64 Member Project - Foursight
QB64 Member Project - Dreamy Clock
QB64 Member Project - STxAxTIC 3D World
QB64 Member Project - Splatter
QB64 Member Project - RGB Color Wheel
QB64 Member Project - Exit
QB64 Member Project - Bowditch curve
QB64 Member Project - Input
QB64 Member Project - Point Blank
QB64 Member Project - Connect Four
QB64 Member Project - Overboard
QB64 Member Project - Line Thickness
QB64 Member Project - ARB Checkers
QB64 Member Project - Inside Moves
QB64 Member Project - Score 4
QB64 Member Project - Kobolts Monopoly
QB64 Member Project - Pivet version one
QB64 Member Project - Martin Fractals version one
QB64 Member Project - Spinning Color Wheel
QB64 Member Project - Kings Vallery version two
QB64 Member Project - Blokus
QB64 Member Project - Rotating Background
QB64 Member Project - 9 Board
QB64 Member Project - Red Scrolling LED Sign
QB64 Member Project - Touche
QB64 Member Project - Martin Fractals version three
QB64 Member Project - Martin Fractals version two
QB64 Member Project - Basic Dithering
QB64 Member Project - Swirl
QB64 Member Project - Spiro Roses
QB64 Member Project - Kings Valley verion one
QB64 Member Project - Kings Court
QB64 Member Project - Amazon
QB64 Member Project - Qubic
QB64 Member Project - Quarto
QB64 Member Project - Full Color LED Sign
QB64 Member Project - Algeria Weather
QB64 Member Project - Rubix's Magic
QB64 Member Project - Sabotage
QB64 Member Project - Pivot version two
QB64 Member Project - Isolation