In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use SetWinEventHook to intercept Windows events, the article is very detailed, has a certain reference value, interested friends must read it!
Messages in Windows can be intercepted with SetWindowsHookEx, but for more advanced Windows events (such as pop-up menu events, ATL+TAB switching events, etc.), SetWinEventHook can be used to intercept messages.
The hooks created by SetWinEventHook are also divided into in-process and out-of-process hooks. In-process hooks are efficient but must exist in the form of DLL, because they must be mapped to other processes. In this Demo, I use out-of-process hooks to intercept all events.
The hook routine is as follows:
VOID CALLBACK WinEventsProc (HWINEVENTHOOK hWinEventHook, DWORD dwEvent, HWND hwnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime)
{
Switch (dwEvent)
{
Case EVENT_SYSTEM_SWITCHSTART:
AtlMessageBox (NULL, _ T ("Alt+Tab start"))
Break
Case EVENT_SYSTEM_SWITCHEND:
AtlMessageBox (NULL, _ T ("Alt+Tab end"))
Break
Case EVENT_SYSTEM_MENUPOPUPSTART:
AtlMessageBox (NULL, _ T ("pop-up menu start"))
Break
Case EVENT_SYSTEM_MENUPOPUPEND:
AtlMessageBox (NULL, _ T ("pop-up menu start"))
Break
}
}
Install out-of-process HOOK (intercept all events for all processes):
HWINEVENTHOOK hHook =:: SetWinEventHook (EVENT_MIN, EVENT_MAX, NULL, WinEventsProc, 0,0, WINEVENT_OUTOFCONTEXT)
Be sure to uninstall HOOK after using it:
:: UnhookWinEvent (hHook)
The above is all the content of the article "how to use SetWinEventHook to intercept Windows events". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.