Udostępnij za pośrednictwem


CharacterReceivedEventArgs Class

Definition

Provides the arguments returned by the event raised when a character is received by the input queue.

public ref class CharacterReceivedEventArgs sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
class CharacterReceivedEventArgs final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
public sealed class CharacterReceivedEventArgs
Public NotInheritable Class CharacterReceivedEventArgs
Inheritance
Object Platform::Object IInspectable CharacterReceivedEventArgs
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

Windows 10 Apps do not receive this event when an Input Method Editor (IME) is enabled. The Input Method Editor (IME) handles all keyboard input and sets Handled to true.

Windows Phone This API is supported in native apps only.

This object is returned by a delegate registered for the following event:

void SetWindow(CoreWindow const& window)
{
    ...
    window.CharacterReceived({this, &App::OnCharacterReceived });
}

// Character received event data in CharacterReceivedEventArgs.
void OnCharacterReceived(
    Windows::UI::Core::CoreWindow const& /* sender */,
    Windows::UI::Core::CharacterReceivedEventArgs const& /* args */)
{
}
// returning character received events data through CharacterReceivedEventArgs

void MyCoreWindowEvents::SetWindow( // implementation called by CoreApplication::Run(), provided for context
    _In_ CoreWindow^ window
    )
{
    // ...
    window->CharacterReceived +=
        ref new TypedEventHandler<CoreWindow^, CharacterReceivedEventArgs^>(this, &CoreWindowEvents::OnCharacterReceived);
    // ...
}

Note

This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX).

Properties

Handled

Gets or sets whether the character-received event was handled or not.

KeyCode

Gets the key code of the character received by the input queue.

KeyStatus

Gets the status of the physical key press that raised the character-received event.

Applies to

See also