Well, if you look at the microsoft side it's just to find the key you want, look at the number in the (parenthesis). It is in hex though.
We have for example
VK_F12 (7B)
F12 key
7B = 123, so basically you can press F12 down with '
$showm.call(123,0,0,0) # Press ALT down' ^^
There is for some reason up to F24, but don't ask me why, neither as me why F22 is 85H and not 85 (133)
Let's for an example say you want to open the keyboard configuration. I.e. we want to press F1:
You look F1 up in the Microsoft list and get:
VK_F1 (70)
F1 key
You convert 70 from hex to dec and get 112
Then it's just
$showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), ''
$showm.call(112,0,0,0) # Press F1 down
$showm.call(112,0,2,0) # Release F1
You may not even have to convert 70. You might be able to use it anyway. I haven't tested it, but this might work as well:
You convert 70 to hex and get 112
Then it's just
$showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), ''
$showm.call(0x70,0,0,0) # Press F1 down
$showm.call(0x70,0,2,0) # Release F1