我使用的是纯粹的cpp。
长按Windows键时,会出现语音助手,但d3d线程不会暂停。 对于我的应用程序是一个游戏,我想在语音助手出现时暂停游戏,我找不到它的api。
答案 0 :(得分:1)
我在Win8官方演示中找到了代码,它适用于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
}
}