How to sendmessage virtual key codes of multiple keys (keys with modifiers, e.g. ctrl+c, ctrl+v)?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
omareg94
Posts: 94
Joined: 27 Jun 2016, 22:46

How to sendmessage virtual key codes of multiple keys (keys with modifiers, e.g. ctrl+c, ctrl+v)?

Post by omareg94 » 24 Feb 2021, 07:09

I use SendMessage to send virtual keys to PotPlayer window while in background.
This is the only way I can send key strokes to PotPlayer window (I tried ControlSend, and it didn't work).

I can send single key strokes easily (e.g. space key like shown below):

Code: Select all

SendMessage, 0x0400, 0x5010,0x20,, ahk_class PotPlayer64     ; 0x20: VK_SPACE
What I need to know is how can I send key strokes with modifier keys (like ctrl+c, ctrl+v, …)

This doesn't work (It seems because I send keys separately):

Code: Select all

SendMessage, 0x0400, 0x5010,0x11,, ahk_class PotPlayer64     ; 0x11: VK_CONTROL
SendMessage, 0x0400, 0x5010,0x43,, ahk_class PotPlayer64     ; 0x43: C key
What I need to do is send Ctrl+C combined.

These are helper reference that helped me:

Code: Select all

; POT_SEND_VIRTUAL_KEY 0x5010 // Virtual Key(VK_UP, VK_DOWN....)
Quote from here.
Virtual-Key Codes

Return to “Ask for Help (v1)”