1

我使用纯 cpp。

长按windows键会出现语音助手,但d3d线程不会暂停。因为我的应用程序是一个游戏,我想在出现语音助手时暂停游戏,我没有找到它的 api。

4

1 回答 1

1

我在 Win8 Official demo 上找到了代码,它适用于 Wp8。

伪代码

CoreApplicationView->Activated += OnActivated;

void OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
{
    CoreWindow::GetForCurrentThread()->Activated += OnWindowActivationChanged;
}

void OnWindowActivationChanged
(Windows::UI::Core::CoreWindow^,Windows::UI::Core::WindowActivatedEventArgs^ args)
{
    CoreWindowActivationState newState = args->WindowActivationState;
    if (newState == CoreWindowActivationState::Deactivated)
    {
        DEACTIVATE code
    }
    else if (newState == CoreWindowActivationState::CodeActivated
    || newState == CoreWindowActivationState::PointerActivated)
    {
        ACTIVATE code
    }
}
于 2013-04-23T08:53:33.683 回答