PSS ID Number: 153380
Article Last Modified on 3/7/1999
BeginProc Chk_Hot_Keys
;!!! key trace
trace_out "Chk_Hot_Keys key #AX"
;!!! end
VK_HK_Queue_Out "Chk_Hot_Keys key scan code = #AX ..."
push eax
;!!! key trace
mov eax,[vkd_gbl_shift_state]
trace_out "Chk_Hot_Keys ... shift state = #AX"
pop eax
push eax
;!!! end
test [VKD_gbl_shift_state], SS_Shift_mask + SS_Toggle_Dn_mask
;Q: are any shift state keys down?
;!!! key trace
trace_outNZ "---------- Shift State keys DOWN"
;!!! end
jnz short chkhk_1 ; Y:
and eax, (NOT SC_Break AND 0FFh) OR VK_Extended
; clear all but Extended bit &
; base scan code
cmp eax, Pause_HK ;Q: special single key hot key?
;!!! key trace
trace_outZ "---------- NO CHECK performed (special key)"
;!!! end
jz DEBFAR je_don_t_check ; N: (chained short jumps)
chkhk_0:
mov eax, [esp] ; retrieve saved eax value
chkhk_1:
IFDEF DEBUG
push ebx
mov ebx, [esp+8]
VK_HK_Queue_Out 'Chk_Hot_Keys #ax, called from ?ebx'
pop ebx
ENDIF
test al, SC_Break ;Q: key being released?
jz short continue_check
TestMem [VKD_flags], VKDf_HK_hold ;Q: already in hot key state?
je_don_t_check:
je DEBFAR don_t_check ; N: don't enter hot key state
; on just the release!
continue_check:
;!!! key trace
trace_out "---------- CHECK performed"
;!!! end
pushad
mov edi, esi ; point edi at CB data
mov cx, ax ; save virtual key
mov esi, [Hot_Key_List]
VMMCall List_Get_First
jz short no_hot_keys ; jump if no hot keys defined
;
; if extended, is all we need to know
; so leave VK_Extended bit in modifier byte and NON SC_Break bits in the
; scan code byte
;
and cx, VK_Extended + (0FFh XOR SC_Break)
.errnz (VK_Extended + (0FFh XOR SC_Break)) - 807Fh
chk_key:
cmp cl, [eax.Hot_Key_scan_code] ;Q: scan codes match?
jne short no_key ; N:
cmp [eax.Hot_Key_extended], AllowExtended_B ;Q: ignore extended flag?
je short accept_key ; Y:
cmp ch, [eax.Hot_Key_extended] ;Q: same ext status?
jne short no_key ; N:
accept_key:
mov ebx, [VKD_gbl_shift_state]
and bx, [eax.Hot_Key_SS_Mask]
cmp bx, [eax.Hot_Key_SS_Compare] ;Q: correct shift state?
je short hot_key_fnd ; Y:
no_key:
VMMCall List_Get_Next ; EAX is next key definition
jnz chk_key
no_hot_keys:
clc ; failed!
jmp short chk_exit
hot_key_fnd:
;!!! key trace
trace_out "---------- HOT KEY found! = #EAX"
;!!! end
VK_HK_Queue_Out "Chk_Hot_Keys Hot key detected #eax"
mov ebx, [eax.Hot_Key_Local_Flag]
bt [edi.disabled_hot_keys], ebx ;Q: key disabled?
jnc short hot_not_disabled ; N: match found
test byte ptr [esp.Pushad_EAX], SC_Break ;Q: release hot key?
IFDEF DEBUG
jnz SHORT D00_handle_up_on_disabled
VK_HK_Queue_Out "Chk_Hot_Keys Hot key disabled"
jmp no_key
D00_handle_up_on_disabled:
ELSE
jz no_key
ENDIF
and [eax.Hot_Key_call_mask], NOT Hot_Key_Down ; flag as key up
mov bl, byte ptr [esp.Pushad_EAX]
mov [VKD_last_key], bl
jmp no_key
hot_not_disabled:
TestMem [eax.Hot_Key_call_mask], Monitor_Key ; monitoring only?
jnz Hot_Key_Activate_Monitor ; Y: Handle internally
stc
mov [esp.Pushad_EBX], eax ; return handle of hot key
chk_exit:
popad
don_t_check:
pop eax
ret
EndProc Chk_Hot_Keys
Keywords: kbHID kbInput KB153380
Technology: kbAudDeveloper kbWin32DDK95 kbWin32DDKSearch kbWin32sSearch kbWin95search kbWinDDKSearch