vc如何屏蔽Ctrl+Alt+Delete消息啊

[复制链接]
查看11 | 回复0 | 2009-11-26 23:27:05 | 显示全部楼层 |阅读模式
我已经回答过了:http://zhidao.baidu.com/question/124463368.html完成这一功能的最简单方法是使用RegisterHotKey函数。在调用该函数后你的进程回在ctrl + alt + del 按下时比系统先得到通知。 你需要处理的消息是WM_HOTKEY。
BOOL RegisterHotKey(HWND hWnd, int id,
UINT fsModifiers,
UINT vk);
参数 fsModifiers指明与热键联合使用按键,可取值为:MOD_ALT MOD_CONTROL MOD_WIN MOD_SHIFT
参数 vk指明热键的虚拟键码The RegisterHotKey function defines a system-wide hot key.SyntaxBOOL RegisterHotKey(
HWND hWnd,
int id,
UINT fsModifiers,
UINT vk);ParametershWnd[in] Handle to the window that will receive WM_HOTKEY messages generated by the hot key. If this parameter is NULL, WM_HOTKEY messages are posted to the message queue of the calling thread and must be processed in the message loop.id[in] Specifies the identifier of the hot key. No other hot key in the calling thread should have the same identifier. An application must specify a value in the range 0x0000 through 0xBFFF. A shared DLL must specify a value in the range 0xC000 through 0xFFFF (the range returned by the GlobalAddAtom function). To avoid conflicts with hot-key identifiers defined by other shared DLLs, a DLL should use the GlobalAddAtom function to obtain the hot-key identifier.fsModifiers[in] Specifies keys that must be pressed in combination with the key specified by the uVirtKey parameter in order to generate the WM_HOTKEY message. The fsModifiers parameter can be a combination of the following values.MOD_ALTEither ALT key must be held down.MOD_CONTROLEither CTRL key must be held down.MOD_SHIFTEither SHIFT key must be held down.MOD_WINEither WINDOWS key was held down. These keys are labeled with the Microsoft Windows logo. Keyboard shortcuts that involve the WINDOWS key are reserved for use by the operating system.vk[in] Specifies the virtual-key code of the hot key.Return ValueIf the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.RemarksWhen a key is pressed, the system looks for a match against all hot keys. Upon finding a match, the system posts the WM_HOTKEY message to the message queue of the thread that registered the hot key. This message is posted to the beginning of the queue so it is removed by the next iteration of the message loop.This function cannot associate a hot key with a window created by another thread.RegisterHotKey fails if the keystrokes specified for the hot key have already been registered by another hot key.If the window identified by the hWnd parameter already registered a hot key with the same identifier as that specified by the id parameter, the new values for the fsModifiers and vk parameters replace the previously specified values for these parameters.Windows NT4 and Windows 2000/XP: The F12 key is reserved for use by the debugger at all times, so it should not be registered as a hot key. Even when you are not debugging an application, F12 is reserved in case a kernel-mode debugger or a just-in-time debugger is resident.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行