Questions tagged [setwindowshookex]

Use this tag to better reference questions related to SetWindowsHookEx. This function installs an application-defined hook procedure into a hook chain.

Installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor the system for certain types of events. These events are associated either with a specific thread or with all threads in the same desktop as the calling thread.

C# Syntax

HHOOK WINAPI SetWindowsHookEx(
  _In_ int       idHook,
  _In_ HOOKPROC  lpfn,
  _In_ HINSTANCE hMod,
  _In_ DWORD     dwThreadId
);

To find more informatoin :

241 questions
0
votes
1 answer

LowLevelKeyboardProc being called for elevated applications when run as non-elevated

My application is run as the current user without admin privileges. It then installs a keyboard hook to catch key events using SetWindowsHookEx with WH_KEYBOARD_LL (not the DLL injection one). It works fine for keystrokes into a fellow non-admin…
Patrick
  • 677
  • 5
  • 14
0
votes
0 answers

Global hooking of registry using Delphi detours in C++ Builder

I am trying to use Detours to hook registry calls using global hooks i use this code but it keeps on giving me exception when i run other C++ Builder apps. I don't know what exactly should I pass to SetWindowsHookEx as hook type. The idea here is…
0
votes
0 answers

SetWindowsHookEx to monitor Windows open and close

I took this example code from here that hooks a function to intercept keyboard events, and it works: #include // variable to store the HANDLE to the hook. Don't declare it anywhere else then globally // or you will get problems since…
Amumu
  • 17,924
  • 31
  • 84
  • 131
0
votes
0 answers

Windows hook stopped working when program is reading database in qt?

My program has a bug which has struggled me for days. My program set windows hook to listen to keyboard press and mouse click, whenever a key is being pressed or the mouse is being clicked, the relevant variable will add one number. And when the…
Theodore Tang
  • 831
  • 2
  • 21
  • 42
0
votes
0 answers

SetWindowsHookEx gives error 126: Module not found when

I need a global system hook which will intercept GDI and get all text on screen from the application. I'm doing this following the instructions…
Megan Caithlyn
  • 374
  • 2
  • 11
  • 33
0
votes
0 answers

Error when attempting to pass hook protocol to SetWindowsHookEx()

I've been working on a little side project as of late and I've run into an odd problem. Essentially, it's a keylogger that uses a low-level keyboard hook to record keystrokes*. This is the class I came up with. class CLogger { public: static…
0
votes
1 answer

SetWindowsHookEx is always returning zero in C#

I'm trying to hook a 3rd party app so that I can interact with the controls. But I am having issues with using SetWindowsHookEx to handle WH_KEYBOARD. It seems there is some problem with parameters that I am passing to SetWindowsHookEx. public…
MK446
  • 448
  • 6
  • 22
0
votes
1 answer

SetWindowsHookEx not working properly

I have tried to make a global mousehotkey with SetWindowsHookEx() so when I press the right mouse button it executes some code. My problem is that when the callback function gets executed, it gives me a weird number for the right button that keeps…
Celmos
  • 25
  • 1
  • 1
  • 7
0
votes
0 answers

SetWindowsHookEx fails ERROR_INVALID_PARAMETER

I wanted to catch CBT notifications of a specific process main thread that I've just created with: STARTUPINFO startupInformation; PROCESS_INFORMATION processInformation; CreateProcess(strWantedEXEPath, NULL, NULL, NULL, FALSE, …
Marco Martins
  • 116
  • 3
  • 8
0
votes
1 answer

Detecting when another application is clipping the mouse cursor?

What I am trying to do is to determine when another application is clipping the mouse cursor. I am using SetWindowsHookEx(WH_MOUSE_LL,...) to detect mouse movement. I could test the mouse position against its previous position every time my…
0
votes
0 answers

SetwindowsHookEX not working when application is not run in elevated mode on Windows 10

I have native dll for setting the windows hook and I am calling it in one of my windows application to set it to a target application. It works perfectly fine when the target application is run in admin(elevated) mode with CallWndProcHook call back…
user1782807
  • 151
  • 3
  • 13
0
votes
0 answers

Validate Window's global hook state

I'm using SetWindowsHookEx to set a global hook to capture all key strokes, unfortunately I'm facing an issue where after a certain period of time, the hook is possibly removed and i no longer receive new key strokes. According MSDN, there is a…
igal k
  • 1,883
  • 2
  • 28
  • 57
0
votes
1 answer

calling setwindowshookex with WH_GETMESSAGE doesn't work on any process except the injector

I previously asked a question about something similar but I believe this time the circumstances are different. I have a DLL that has standard hook, unhook and msgProc functions. I load this DLL in my main application and then call 'hook', that is…
DD.
  • 89
  • 2
  • 13
0
votes
0 answers

"Could not find specified module" error SetWindowsHookEx

I want my program to be able to detect mouse clicks while it is minimized and not in focus at all. I found on CodePlex a library called Gma.UserActivityControl and I downloaded that. I can build their project just fine and their demo does exactly…
0
votes
1 answer

Listen close event of iexplorer in my application

I am writing a win32 application by C++, and I want it to do something when all iexplorer.exe were closed. I know that SetWindowsHook() may be useful in my case. But if I have no idea about the process or thread ID of IE, because every time open…
Lion Kuo
  • 239
  • 4
  • 13