How to hook a PostMessage function only by a key-up event

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
ironsand
Posts: 2
Joined: 09 May 2021, 20:53
Contact:

How to hook a PostMessage function only by a key-up event

Post by ironsand » 09 May 2021, 21:23

Can I call `PostMessage` by key-up event without key-down?
There is a Japanese special key that only send key-up event when I press the key.
FF 072 u 0.16 not found
FF 072 u 0.17 not found
FF 072 u 0.19 not found
When I remap it by

Code: Select all

sc072::1
, it send key-up event for `1`.
FF 072 h u 1.36 not found
31 002 i u 0.00 1
FF 072 h u 0.74 not found
31 002 i u 0.00 1


But when I call `PostMessage` for language change, nothing happens.

Code: Select all

sc072::PostMessage 0x50, 0, 0x4110411,, "A"
FF 072 u 0.20 not found
FF 072 u 0.14 not found
FF 072 u 0.09 not found
74 03F d 0.30 F5
There was a similar question in this forum, but haven't solved.
https://autohotkey.com/board/topic/22811-remapping-a-japan-mac-keyboard-for-a-pc/

Thanks

lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

Re: How to hook a PostMessage function only by a key-up event

Post by lexikos » 09 May 2021, 21:43

The difference between sc072::1 (remap) and sc072::PostMessage (hotkey) is explained by Remapping Keys.

It will only call PostMessage if there is a key-down event for sc072. You should use a key-up hotkey instead.

Code: Select all

sc072 up::PostMessage 0x50, 0, 0x4110411,, "A"

ironsand
Posts: 2
Joined: 09 May 2021, 20:53
Contact:

Re: How to hook a PostMessage function only by a key-up event

Post by ironsand » 16 May 2021, 15:31

lexikos wrote:

Code: Select all

sc072 up::PostMessage 0x50, 0, 0x4110411,, "A"
Thanks! I could remap the key with this code.

Post Reply

Return to “Ask for Help (v2)”