c++ - UnregisterHotKey() 在 Windows Mobile 上不起作用

标签 c++ winapi windows-mobile

调用 RegisterHotKey() 后,它似乎可以工作,因为按下时音量增大/减小没有响应,但是当我调用 UnregisterHotKey() 恢复默认值时,除非启动设备,否则音量增大/减小仍然没有响应。我怎样才能恢复它们?谢谢。

void RestoreVolumeKeys()
{
    hWndTray = FindWindow(_T("HHTaskBar"), NULL);
    if(hWndTray)
    {
        UnregisterHotKey((HWND)hWndTray, VK_TVOLUMEDOWN);
        UnregisterHotKey((HWND)hWndTray, VK_TVOLUMEUP);

    }
    else//HHTaskBar not found then try find Tray
    {     
        hWndTray = FindWindow(_T("Tray"), NULL);
        if(hWndTray)
        {
            UnregisterHotKey((HWND)hWndTray, VK_TVOLUMEDOWN);
            UnregisterHotKey((HWND)hWndTray, VK_TVOLUMEUP);

        }
    }
}

最佳答案

你没有正确使用它。第二个参数不是虚拟键,它是您在 RegisterHotKey() 调用中使用的 id

BOOL RegisterHotKey(HWND hWnd,
    int id,                       // <=== this one
    UINT fsModifiers,
    UINT vk
);

经常检查 winapi 函数的返回值以发现此类错误。

关于c++ - UnregisterHotKey() 在 Windows Mobile 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10238666/

相关文章:

c++ - EnterSynchronizationBarrier卡在Windows 8中

c# - Windows CE 4.2 的限制是什么?

c++ - Netbeans C/C 不编译

c++ - 姐妹类代表团

c# - 在没有进程引用它后删除 "in use"文件

deployment - 使用我的 Windows Mobile 应用程序部署 SQL Server CE

c# - Windows Mobile 应用程序中 DataGrid 的列宽

c++ - 使用指针初始化多维数组

c++ - 我可以在核心 i7 上获得的最大 cpu 使用率是多少

Python win32com : Internet Explorer COM object ?(曾经工作过吗?)