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
0 answers

Windows kills SetWindowsHookEx when click on the Help Button

I am having a strange problem. I am creating two hooks for a c# application that I am developing, one for Keyboard and one for mouse using the following code: //keyboard SetWindowsHookEx(13, keyBoardDelegate, IntPtr.Zero,…
mpc
  • 67
  • 1
  • 9
0
votes
0 answers

changing the message with hooks

i want to learn a bit about how to use hooks so im trying to make a program that will change the input of 'A' to 'B', i'm trying to use the WH_KEYBOARD hook and according to…
0
votes
1 answer

Calling SetWindowsHookEx inside VS2008 debugger always returns NULL

we're working on a .Net application that does a low level keyboard hook. When we call the SetWindowsHookEx running inside the debugger the call always fail. When running from the compiled executable everything works fine. If we attach to the…
Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207
0
votes
1 answer

SetWindowsHookEx another process made by C# always return 0 IntPtr

I am trying to hook mouse click event to a windows application which is made of C# as well. This is my code; private const int WH_MOUSE = 7; [DllImport("user32.dll", SetLastError = true)] static extern uint GetWindowThreadProcessId(IntPtr hWnd, out…
Joshua Son
  • 1,839
  • 6
  • 31
  • 51
0
votes
0 answers

C# SetWindowsHookEx with DirectX

I'm about to write something like a screenshot programm. For now I used the PrintWindow function with the handle of the active window -> GetForgroundWindow and to start it I set a hook on the keyboard. When I capture normal windows on the desktop…
ColdJackle
  • 31
  • 6
0
votes
2 answers

Can WH_MOUSE catch global events?

I'm trying to develop a WPF C# application that captures mouse clicks even (especially) if it's in background in order to start another task. On MSDN documentation ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990(v=vs.85).aspx ) I…
Saverio Terracciano
  • 3,885
  • 1
  • 30
  • 42
0
votes
0 answers

Global Setwindowshookex to get WM_TOUCH from all windows

I have native dll for setting the windows hook (global) and i am calling it in one of my windows form application to set a global hook. It works perfectly fine and i get the messages in the app. But the Internet Explorer is Touch Window, and if i…
0
votes
1 answer

Low level keyboard hook doesn't work for a specific device in a specific app

I have coded up a low level keyboard hook using SetWindowsHookEX() on Windows CE 4.2 and it seems to work just fine. I am able to see key events using the keyboard and a barcode scanner in notepad and other applications as desired, but I do not…
Mike
  • 185
  • 1
  • 1
  • 7
0
votes
3 answers

not able to install hooks for all threads in a process

I am hooking keyboard in application . Requirement is to hook keyboard in all threads in the process. I used SetWindowsHookEx API SetWindowsHookEx(WH_KEYBOARD_LL, (HOOKPROC)::KeyboardHookProc, hInst, 0); The hook is created for all the threads in…
anand
  • 11,071
  • 28
  • 101
  • 159
0
votes
1 answer

SetWindowsHookEx WH_KEYBOARD_LL not getting events

I am using SetWindowsHookEx() to create a keyboard hook. The creation seems to be successful but the procedure which is registered never gets called. Is there something I am doing wrong? #region Windows API Functions…
Nippysaurus
  • 20,110
  • 21
  • 77
  • 129
0
votes
1 answer

SetWindowHookEx blocks WM_ERASEBKGND in nested window

I have the following MFC application UI structure: Main Frame - CView derived class - CWnd derived class --- CMFCTabCtrl derived class ---- CDialog derived class The CMFCTabCtrl can hold in turn the CWnd derived class and so on and so on... If…
Jonathan
  • 552
  • 1
  • 4
  • 10
0
votes
1 answer

SetWindowsHookEx fails to inject

I'm trying to intercept messages sent to a window running in another process, so that I can react to a few of them. The injecting application is an x86 WPF application that calls this method via p/invoke. I pass the handle to a window in another…
Tim Cooke
  • 862
  • 7
  • 14
0
votes
0 answers

Low level Keyboard hook application using SetWindowsHookEx MS-Windows API function

I am currently underway to develop an application for hooking. I am using C++ to accomplish that and i am using the functions from the MS-Windows hook library. My application creates a global hook via a .DLL file and then i can send…
Diesel
  • 1
  • 1
0
votes
1 answer

Can an application that calls SetWindowsHookEx() capture autocomplete URLs & passwords?

I have an application that uses SetWindowsHookEx() to set a keyboard hook for keystroke logging. This works fine, but in the situation where the web browser is autocompleting a URL or password of course the app doesn't capture the characters that…
jeffm
  • 3,120
  • 1
  • 34
  • 57
0
votes
1 answer

how to know when the foreground window has changed

I'm writing an application in c# and I need to know when the for the ground window has changed I used SetWindowsHookEx but I don't get the call back when I switch between windows my code: private const int WH_CALLWNDPROC = 4; private delegate…
user1839169
  • 207
  • 2
  • 4
  • 16