Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

PostKeybdMessage

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function posts a keyboard message to the specified window.


BOOL PostKeybdMessage( 
  HWND hwnd, 
  UINT VKey, 
  KEY_STATE_FLAGS KeyStateFlags, 
  UINT cCharacters, 
  UINT* pShiftStateBuffer, 
  UINT* pCharacterBuffer 
);
hwnd

[in] Handle to the window that receives the message. It must identify a window owned by the calling thread. If hwnd is NULL, then the keyboard message is sent to the active window or window with the focus of the calling thread. If hwnd is –1, then the keyboard message is sent to the active window or window with the focus of the system foreground thread.

VKey

[in] Virtual key code. This parameter can be set to 0.

KeyStateFlags

[in] State of the key. The key states are described in the following table.

Flag Description

KeyStateToggledFlag

Key is toggled.

KeyStatePrevDownFlag

Key was previously down.

KeyStateDownFlag

Key is currently down.

KeyShiftAnyCtrlFlag

Left or right CTRL key is down.

KeyShiftAnyShiftFlag

Left or right SHIFT key is down.

KeyShiftAnyAltFlag

Left or right ALT key is down.

KeyShiftCapitalFlag

VK_CAPITAL is toggled.

KeyShiftLeftCtrlFlag

Left CTRL key is down.

KeyShiftLeftShiftFlag

Left SHIFT key is down.

KeyShiftLeftAltFlag

Left ALT key is down.

KeyShiftLeftWinFlag

Left Windows logo key is down.

KeyShiftRightCtrlFlag

Right CTRL key is down.

KeyShiftRightShiftFlag

Right SHIFT key is down.

KeyShiftRightAltFlag

Right ALT key is down.

KeyShiftRightWinFlag

Right Windows logo key is down

KeyShiftDeadFlag

Corresponding character is dead character.

KeyShiftNoCharacterFlag

No characters in pCharacterBuffer to translate.

cCharacters

[in] Number of characters in the pCharacterBuffer array.

pShiftStateBuffer

[in] Pointer to a buffer that contains a corresponding shift state entry for each character in the pCharacterBuffer array. The shift state for each character must be the same as the KeyStateFlags parameter. This parameter cannot be NULL.

pCharacterBuffer

[in] Pointer to a buffer that contains the characters to send. This parameter cannot be NULL.

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

The characters in pCharacterBuffer are the characters posted to the receiver's queue when TranslateMessage is called for the VK key event. Unlike the keybd_event function, PostKeybdMessage does not affect the global key state.

PostKeybdMessage does not support a different state for each translated character. If a different state is required for each character, then individual calls to PostKeybdMessage must be made.

If VKey is set to 0 when TranslateMessage is called, then the virtual key translation is also set to 0. Because 0 is not valid for virtual key, an application should ignore it.

Headerwinuser.h
LibraryKbdui.lib
Windows Embedded CEWindows CE 2.0 and later
Windows MobileWindows Mobile Version 5.0 and later
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.