Freigeben über


GetKeybdGuidFromKeybdMessage (Compact 2013)

3/28/2014

GetKeybdGuidFromKeybdMessage enables an application to determine the GUID of the keyboard that generated a keyboard event. With this GUID, the application can verify that it has the correct keyboard layout loaded.

Syntax

HRESULT GetKeybdGuidFromKeybdMessage( 
      HWND hWnd,
    WPARAM wParamOfWmChar,
    LPARAM lParamOfWmChar,
    GUID *pguidKeyboard
);

Parameters

  • hWnd
    [in] Specifies the handle to the window of the application.
  • wParamOfWmChar
    [in] Specifies the wParam of the corresponding WM_CHAR message.
  • lParamOfWmChar
    [in] Specifies the lParam of the corresponding WM_CHAR message.
  • pguidKeyboard
    [out] Pointer to a buffer that can hold the keyboard GUID.

Return Value

Returns S_OK if the keyboard guid is successfully copied to the buffer. In the case of failure, GetKeybdGuidFromKeybdMessage returns one of the following errors:

  • E_INVALIDARG
    If no matched keyboard messages exist.
  • E_POINTER
    If pguidKeyboard is NULL.
  • E_NOKEYBDGUID
    If a GUID is not found in the record.
  • E_FAIL
    For all other failures.

Remarks

The keyboard message is generated and recognized by PostKeybdMessageEx and keybd_eventEx. If no record exists for the keyboard message, either the keyboard message is not sent by PostKeybdMessageEx or keybd_eventEx, or the record is already expired. The record expires after the WM_CHAR message is processed by the application.

For more information about using the GUID and input language to verify that the correct keyboard layout is loaded, see Input Method Editor Registry Settings.

Applications can filter keyboard messages that come from invalid GUIDs as unsecure messages.

Requirements

Header

winuser.h

See Also

Reference

Keyboard Functions