How can I hook Windows functions in C/C++?

Take a look at Detours, it’s perfect for this sort of stuff. For system-wide hooking, read this article from MSDN. First, create a DLL which handles hooking the functions. This example below hooks the socket send and receive functions. #include <windows.h> #include <detours.h> #pragma comment( lib, “Ws2_32.lib” ) #pragma comment( lib, “detours.lib” ) #pragma comment( … Read more

Is there Windows system event on active window changed?

Yes, you can use SetWinEventHook function. hEvent = SetWinEventHook(EVENT_SYSTEM_FOREGROUND , EVENT_SYSTEM_FOREGROUND , NULL, WinEventProcCallback, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); ……. VOID CALLBACK WinEventProcCallback ( HWINEVENTHOOK hWinEventHook, DWORD dwEvent, HWND hwnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime) { /* your code here */ }

How to get the word under the cursor in Windows?

On recent versions of Windows, the recommended way to gather information from one application to another (if you don’t own the targeted application of course) is to use the UI Automation technology. Wikipedia is pretty good for more information on this: Microsoft UI Automation Basically, UI automation will use all necessary means to gather what … Read more

Git pre-push hooks

Git got the pre-push hook in the 1.8.2 release. Sample pre-push script: https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks–pre-push.sample 1.8.2 release notes talking about the new pre-push hook: https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt