PostVirtualKeyEvent 

1.0     2.0     

Posts a virtual key-code event to Windows.

void PostVirtualKeyEvent( UINT vk, BOOL fUp )

Parameters

vk

Virtual key. This argument takes a Windows VK_ constant as defined in the WINDOWS.H include file. Depending on the key, this is either the key scan code or the ASCII equivalent to represent a character key. For example, VK_A has the value  A. 

fUp

Key-transition flag. This parameter should be FALSE to specify that the key is down or TRUE to specify that it is up.

Return Value

This function does not return a value.

Comments

PostVirtualKeyEvent does not check the virtual key code for errors.

Normally, an application should follow a key-down message with a corresponding key-up message to accurately simulate the actual events from the keyboard. You can post repeating keys by calling PostVirtualKeyEvent consecutively, one call per repeat, with fUp set to FALSE. End the sequence with a single call to PostVirtualKeyEvent with fUp set to TRUE.

The events are posted to the system message queue. The application with the input focus can receive the messages by calling the Windows GetMessageIXKDTP or PeekMessage0X9XXX function.

See Also

AtomicVirtualEvent, PostVirtualMouseEvent