Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Monitor typed characters - Show Hidden Password Characters
#4
To overcome converting the "SHIFT+..." output to its equivalent character I came up with the following modification in the code :

Function monitor_input_hook
Code:
Copy      Help
function nCode wParam KBDLLHOOKSTRUCT&h

;www.quickmacros.com/forum/viewtopic.php?p=32711
;Monitor typed characters - Show Hidden Password Characters MF

;Test with :
;mac "monitor_input_hook"
;str aps
;int i=inp(aps  "Δώστε κείμενο" "Give" "")
;shutdown -6 0 "monitor_input_hook"

if(getopt(nargs)=0)
,if(getopt(nthreads)>1) ret
,int- t_keyhook
,t_keyhook=SetWindowsHookEx(WH_KEYBOARD_LL &monitor_input_hook _hinst 0)
,MessageLoop
,ret

;debug
;FormatKeyString h.vkCode 0 &_s
;out "%s %s%s" _s iif(h.flags&LLKHF_UP "up" "down") iif(h.flags&LLKHF_INJECTED ", injected" "")

int- shm
str s
if h.vkCode=160 or  h.vkCode=161
,shm=iif(h.flags&LLKHF_UP 0 1)
;,out F"Shift {shm}"
else
;,out F"Character {h.vkCode} : {shm} - {h.flags&LLKHF_UP}"
,if h.flags&LLKHF_UP
;,,out F"Character {h.vkCode} : {shm} - {h.flags&LLKHF_UP}"
,,FormatKeyString h.vkCode 0 &s
,,_i=s[0]
,,out VKtoStr(_i shm)

,,
,,
ret CallNextHookEx(t_keyhook nCode wParam &h)

where function VKtoStr :

Function VKtoStr
Code:
Copy      Help
;/
function~ int'k int'shft

str s=" "

if k>=65 and k<=90
,if shft=0
,,s[0]=k+32
,else
,,s[0]=k
,ret s

if shft=0
,s[0]=k
,ret s
,
;126 ~    96 `
;33 !    49 1
;64 @    50 2
;35 #    51 3
;36 $    52 4
;37 %    53 5
;94 ^    54 6
;38 &    55 7
;42 *    56 8
;40 (    57 9
;41 )    48 0
;95 _    45 -
;43 +    61 =
;123 {    91 [
;125 }    93 ]
;124 |    92 \
;58 :    59 ;
;34 "    39 '
;60 <    44 ,
;62 >    46 .
;63 ?    47 /



IStringMap mChar._create
lpstr sChar=
;96 126
;49 33
;50 64
;51 35
;52 36
;53 37
;54 94
;55 38
;56 42
;57 40
;48 41
;45 95
;61 43
;91 123
;93 125
;92 124
;59 58
;39 34
;44 60
;46 62
;47 63
,
mChar.AddList(sChar)

lpstr v=mChar.Get(F"{k}")
if(v)
,_i=val(v)
,s[0]=_i
else
,s[0]=255
ret s

,

Any advice is still mostly welcome.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)