flat assembler
Message board for the users of flat assembler.

Index > Windows > compare fails?

Author
Thread Post new topic Reply to topic
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
based on my file here http://board.flatassembler.net/topic.php?t=1670 im trying to determine when a user presses VK_F5 through my hook. simply changing the lines:

Code:
       mov      eax, [lp] ;KBDLLHOOKSTRUCT
       cmp      dword [eax+4],VK_RIGHTWINKEY ;kbdllhookstruct.vkCode
       je       disable
    


to:

Code:
       mov      eax, [lp] ;KBDLLHOOKSTRUCT
       cmp      dword [eax+4],VK_F5 ;kbdllhookstruct.vkCode
       je       disable
    


fails. for that matter all VK_ keycodes i tested failed also, i could only get VK_RWIN AND VK_LWIN to work. am i missing something here? attached is the same file as the link


Description:
Download
Filename: hook.asm
Filesize: 2.96 KB
Downloaded: 81 Time(s)

Post 30 Mar 2005, 23:35
View user's profile Send private message Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld
Code:
invoke  SetWindowsHookEx,WH_KEYBOARD,hookproc,[hinst],0
...
proc hookproc, ncode,wp,lp
       push     ebx esi edi
       mov      eax,[ncode]
       cmp      ax,HC_ACTION
       jne      skip
       bt       [lp],31
       jc       skip
  which_key:
       mov      eax, [wp]
       cmp      al,VK_F5
       je       disable
       cmp      al,VK_SPACE
       jne      skip
  disable:
       invoke   MessageBox,0,title,title,0
       or       eax,-1
       jmp      finish_up
  skip:
       mov      eax,0
       cmp      word[ncode],0
       jge      finish_up
       invoke   CallNextHookEx,[hook],[ncode],[wp],[lp]
  finish_up:
       pop      edi esi ebx
       return
endp    
Post 31 Mar 2005, 00:09
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
does it work for you mike, doesnt for me. and why would it have previously worked with _RWIN and _LWIN anyways?
Post 31 Mar 2005, 00:33
View user's profile Send private message Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
ok, WH_KEYBOARD_LL doesnt work, WH_KEYBOARD does. why is this?
Post 31 Mar 2005, 00:35
View user's profile Send private message Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld
In case of WH_KEYBOARD_LL you need a VIRTUAL key-code, not a SCAN-code, so you need to use [eax] instead of [eax+4]
Post 31 Mar 2005, 01:05
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
interesting coincidence then my old example worked with _RWIN and _LWIN, virtual keycode must be +4 of scan code for them
Post 31 Mar 2005, 01:15
View user's profile Send private message Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld
VK_LWIN & VK_RWIN are working fine for me with [eax].
Post 31 Mar 2005, 01:23
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
works like a charm now, thanks mike Smile
Post 31 Mar 2005, 01:46
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.