flat assembler
Message board for the users of flat assembler.

Index > Windows > SendInput won't release certain keys?

Author
Thread Post new topic Reply to topic
randomdude



Joined: 01 Jun 2012
Posts: 83
randomdude
is it possible to release VK_CONTROL using SendInput? :S i tried everything with no success

another question, is it possible to disable a key from reaching any application except the one im using? in AutoHotkey i can use for example F1 for a macro and when pressing F1, the F1 key wont be detected by any other program. it seems to use BlockInput api but no idea how can i use it...


Description:
Download
Filename: example.rar
Filesize: 2.53 KB
Downloaded: 36 Time(s)

Post 25 Nov 2013, 16:15
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17346
Location: In your JS exploiting you and your system
revolution
randomdude wrote:
another question, is it possible to disable a key from reaching any application except the one im using? in AutoHotkey i can use for example F1 for a macro and when pressing F1, the F1 key wont be detected by any other program. it seems to use BlockInput api but no idea how can i use it...
I am aware of only one way to capture and filter keys and that is to use DLL injection. MS has a tutorial on how to setup DLL injection, so perhaps you can search for that. A lot of utility software uses injection to capture various actions.
Post 26 Nov 2013, 03:12
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
randomdude,

For Win2000+ you may try RegisterHotKey().
Post 26 Nov 2013, 10:25
View user's profile Send private message Reply with quote
randomdude



Joined: 01 Jun 2012
Posts: 83
randomdude
great, thx!

Code:
proc start

        stdcall RegisterHotKeys
        .msg_loop:
        invoke  GetMessage,Msg,0,0,0
        test    eax,eax
        jz      .end
        cmp     dword[Msg.message],WM_HOTKEY
        jne     .msg_loop
        stdcall CheckHotkey,dword[Msg.wParam]
        cmp     byte[ExitApp],1
        jne     .msg_loop
        .end:
        stdcall UnregisterHotKeys
        ;invoke  MessageBox,0,teststr,testcap,MB_OK
        invoke  ExitProcess,0
endp
    


now i just have the annoying problem of SendInput not releasing VK_CONTROL, does anyone have any idea of why? :/
Post 26 Nov 2013, 12:15
View user's profile Send private message Reply with quote
randomdude



Joined: 01 Jun 2012
Posts: 83
randomdude
edit:

jesus... finally i found out the issue...

Code:
INPUT INPUT_KEYBOARD,<VK_?,0,KEYEVENTF_KEYUP,0,0>     


every value was being send as a dword, so the dwFlags was always 0

now.. any idea on how can specify the value size in macro? Very Happy
Post 27 Nov 2013, 12:43
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
randomdude,

Swap mi and ki members of anonymous union inside INPUT structure.

It's only a palliative solution, if you need both keyboard and mouse events, use something like INPUT INPUT_KEYBOARD,<VK_CONTROL+0 shl 16,KEYEVENTF_KEYUP,0,0> (i.e. use MOUSEINPUT template for initializer and pack wVk and wScan into doubleword manually).

As a side note, invoke SendInput,4,keyboard_ctrl_v,sizeof.INPUT doesn't correspond with number of members in keyboard_ctrl_v array.
Post 27 Nov 2013, 17:27
View user's profile Send private message Reply with quote
randomdude



Joined: 01 Jun 2012
Posts: 83
randomdude
for now i just removed the wScan parameter that im not using. thanks anyway for the suggestions, baldr Smile

yeah, i forgot to remove the four VK_RETURN inputs from the example
Post 06 Dec 2013, 13:44
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 YouTube, Twitter.

Website powered by rwasa.