1  /  1  页   1 跳转 查看:431

系统键问题

系统键问题

运行我的全屏程序后不允许切换,怎么办?
就是说,要屏敝掉 ALT+TAB键 ,
在此,先谢过了!
 

回复:系统键问题

*
用户模块
return TRUE; --->丢弃该消息
*/
LRESULT CALLBACK Hotkey_Filter(int nCode, WPARAM wParam, LPARAM lParam)
{
          KBDLLHOOKSTRUCT *Key_Info = (KBDLLHOOKSTRUCT*)lParam;
            if (HC_ACTION == nCode)
            {
                        if (WM_KEYDOWN == wParam || WM_SYSKEYDOWN)  //如果按键为按下状态
                        {
                                    if (Key_Info->vkCode == VK_LWIN || Key_Info->vkCode == VK_RWIN) //屏敝 WIN(左右) 键
                                    {
                                                return TRUE;
                                    }
                                    if (Key_Info->vkCode == 0x4D && ((GetKeyState(VK_LWIN) & 0x8000) ||
                                                                                                  (GetKeyState(VK_RWIN) & 0x8000))) //屏敝 WIN+D 组合键(左右)
                                    {
                                                return TRUE;
                                    }
                                    if (Key_Info->vkCode == 0x44 && ((GetKeyState(VK_LWIN) & 0x8000) ||
                                                                                                  (GetKeyState(VK_LWIN) & 0x8000)))  //屏敝 WIN+M 组合键(左右)
                                    {
                                                return TRUE;
                                    }
                                    if (Key_Info->vkCode == 0x1b && GetKeyState(VK_CONTROL) & 0x8000) //屏敝 CTRL + ESC 组合键
                                    {
                                                return TRUE;
                                    }
                                    if (Key_Info->vkCode == VK_TAB && Key_Info->flags & LLKHF_ALTDOWN) //屏敝 ATL + TAB 组合键
                                    {
                                                return TRUE;
                                    }
                                    if (Key_Info->vkCode == VK_ESCAPE && Key_Info->flags & LLKHF_ALTDOWN) //屏敝 ATL + ESC 组合键
                                    {
                                                return TRUE;
                                    }
                        }

            }
            return CallNextHookEx(h_HotKey, nCode, wParam, lParam); //回调
}

BOOL Hotkey_Install(DWORD ThreadID)
{
            h_HotKey = SetWindowsHookEx(WH_KEYBOARD_LL, (HOOKPROC)Hotkey_Filter, //安装低级键盘钩子
          GetModuleHandle("hotkey"), ThreadID);
            if (NULL == h_HotKey)
            {
                        MessageBox(NULL, "安装钩子出错 !", "error", MB_ICONSTOP);
                        return FALSE;
            }
            return TRUE;
}

BOOL Hotkey_UnInstall()
{
            UnhookWindowsHookEx(h_HotKey); //卸载钩子
            return TRUE;
}
暂时没有想好
 
1  /  1  页   1 跳转

版权所有 程序员家园论坛   Sitemap

Powered by Discuz!NT 2.1.202    Copyright © 2001-2008 Comsenz Inc.
Processed in 0.0312512 second(s) , 4 queries. 浙ICP备07502118号
返顶部