【问题标题】:Unicode input Windows 8.1 Store AppUnicode 输入 Windows 8.1 Store App
【发布时间】:2015-03-18 18:41:53
【问题描述】:

如果我按下键盘上的一个键,我想接收正确的本地化 Unicode-Char。 (在使用 C++ 或 C# 的 Windows 8.1 应用商店应用程序中)

我目前正在通过KeyEventArgs-Event 接收键盘输入

C++:

Windows::UI::Core::CoreWindow^ window = Windows::UI::Core::CoreWindow::GetForCurrentThread();
window->KeyDown += ref new Windows::Foundation::TypedEventHandler<Windows::UI::Core::CoreWindow^, Windows::UI::Core::KeyEventArgs^>(this, &ComponentInterface::OnKeyDown);

void ComponentInterface::OnKeyDown(Windows::UI::Core::CoreWindow^ window, Windows::UI::Core::KeyEventArgs^ e)
{
    unsigned int key = e->KeyStatus.ScanCode;
}

【问题讨论】:

    标签: c# c++ unicode windows-store-apps windows-8.1


    【解决方案1】:

    获取字符句柄CoreWindow::CharacterReceived 而不是CoreWindow::KeyDown

    KeyDown 事件仅提供键本身,它本身并没有包含足够的上下文来知道最终将生成哪个字符。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-25
      • 1970-01-01
      • 2015-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-06
      • 2014-06-01
      相关资源
      最近更新 更多