VC下简易实现全局热键--无DLL无钩子(Register HotKey)
来源:互联网 发布:青年网络文明志愿宣言 编辑:程序博客网 时间:2024/05/05 15:52
使用RegisterHotKey()函数即可.
MSDN:The RegisterHotKey function defines a system-wide hot key.
MSDN:The RegisterHotKey function defines a system-wide hot key.
- //函数原型:
- BOOL RegisterHotKey(
- HWND hWnd, // window to receive hot-key notification
- int id, // identifier of hot key
- UINT fsModifiers, // key-modifier flags
- UINT vk // virtual-key code
- );
具体实现: 1.首先加入函数
- BOOL CMyDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // Set the icon for this dialog. The framework does this automatically
- // when the application's main window is not a dialog
- SetIcon(m_hIcon, TRUE); // Set big icon
- SetIcon(m_hIcon, FALSE); // Set small icon
-
- // TODO: Add extra initialization here
-
- //注册热键(Ctrl+W,标识9999)
- RegisterHotKey(this->m_hWnd,9999,MOD_CONTROL,'W');
-
- return TRUE; // return TRUE unless you set the focus to a control
- }
2.加入相应全局热键函数
- //相应WindowProc消息,加入函数
- LRESULT CMyCatchScreenDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
- {
- switch(message)
- {
- ///////////////
- //热键操作
- case WM_HOTKEY:
- if(wParam==9999)
- {
- if(!IsWindowVisible())
- {
- //ShowMyWindow(); // 实现代码
- }
- else
- {
- //HideMyWindow(); //实现代码
- }
- }
- break;
- }
- return CDialog::WindowProc(message, wParam, lParam);
- }
- VC下简易实现全局热键--无DLL无钩子(Register HotKey)
- [VC++]HotKey热键 - msdn
- VC全局热键的实现
- vc实现无dll远程线程注入
- VC++实现无进程无dll线程注射技术
- vc 无dll注入
- c# 全局键盘钩子(无窗体)
- C#实现注册全局热键(register hot key)
- 使用钩子技术实现QT中的全局热键
- vc++实现无进程无DLL无硬盘文件无启动项的ICMP后门后门程序
- vc++实现无进程无DLL无硬盘文件无启动项的ICMP后门后门程序
- vc++实现无进程无DLL无硬盘文件无启动项的ICMP后门后门程序
- VC++实现监视系统的键盘操作 创建记录键盘动作的全局钩子DLL
- Register HotKey
- VC添加全局热键
- vc全局钩子实现程序监控
- VC实现的全局键盘钩子
- DLL全局钩子
- 用C#开发WEB报表的实例(开头的话)
- 在.Net中用C#调用Windows系统信息的代码
- vi 简明手册
- 程序员修炼之道笔记(一)
- asp.net用的一些技巧
- VC下简易实现全局热键--无DLL无钩子(Register HotKey)
- NGN网络核心协议 - SIP 协议详解
- XP环境在VC6.0下使程序直接具有XP风格(XP style)
- VC下实现窗体透明效果(clarity for CDialog)
- VC下不让窗口在任务栏显示 (Hide CDialog of task bar)
- VoIP基本概念:SIP 协议概述
- tinyMCE使用/集成/设置/详解
- 游戏编程指南 -- 容纳游戏的空间(windows编程基础)
- MFC中CBitmap的简单复制方法 (Copy CBitmap)