动态禁用/启用Window 2000下的Ctrl+Alt+Delete组合键(终结版)
图片如下:
使用方法:
1:
包含C++类CCADMgr头文件,如:#include "CADMgr.h"2:
定义变量如:CCADMgr m_cadMgr;3:设置Ctrl+Alt+Del消息通知窗口,如:m_cadMgr.SetTargetWnd(m_hWnd);4:禁用或启用,如:m_cadMgr.DisableCAD(m_bDisabled);5:响应消息:
声明函数:afx_msg void OnHotKey(WPARAM wParam, LPARAM lParam);
消息映射:ON_MESSAGE(WM_HOTKEY, OnHotKey)
函数实现:
void CTrapCADDlg::OnHotKey(WPARAM wParam, LPARAM lParam)
{
WORD wKey = HIWORD(lParam);
WORD wModifier = LOWORD(lParam);
BOOL bAltDown = ((wModifier & VK_MENU) != 0 ? TRUE : FALSE);
BOOL bCtrlDown = ((wModifier & VK_CONTROL) != 0 ? TRUE : FALSE);
//按下Ctrl + Alt + Del组合键
if(bCtrlDown && bAltDown && wKey == VK_DELETE)
AfxMessageBox("对不起, Ctrl+Alt+Delete组合键已经被禁用了!", MB_OK|MB_ICONERROR);
}