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
4
votes
1 answer

Hooking Win32 windows creation/resize/querying sizes

I'm trying to "stretch" an existing application. The goal is to make an existing application become larger without changing the code of that application. A cosntraint is that the stretched application will not "notice" it, so if the application…
Elisha
  • 23,310
  • 6
  • 60
  • 75
4
votes
3 answers

Simple way to hook registry access for specific process

Is there a simple way to hook registry access of a process that my code executes? I know about SetWindowsHookEx and friends, but its just too complex... I still have hopes that there is a way as simple as LD_PRELOAD on Unix...
Demiurg
  • 1,597
  • 8
  • 26
  • 40
4
votes
1 answer

The Difference between to usages of SetWindowsHookEx

First: I'm using Visual Studio 2010 on Windows XP - 32 Bit. Right now I'm trying to write a DLL which will enable another application to work with low level keyboard hooks. Even though I got it to work - I now want to understand why. The non-working…
Daniel Heinrich
  • 790
  • 4
  • 12
4
votes
1 answer

Hook WH_GETMESSAGE and filter WM_SETTEXT only

Using the Microsoft Spy++ I see that Notepad++ receives a WM_SETTEXT message, when you open/create a new document. I need to hook title changes on Windows, so I'm trying doing WH_GETMESSAGE hook, and filtering only WM_SETTEXT. But so far I'm…
LessStress
  • 187
  • 2
  • 17
4
votes
2 answers

Unloading DLL from all processes after unhooking global CBT hook

How do you properly unload a DLL from all processes when the system-wide hook that loaded them gets unloaded? From MSDN: You can release a global hook procedure by using UnhookWindowsHookEx, but this function does not free the DLL containing…
Vegard Larsen
  • 12,827
  • 14
  • 59
  • 102
4
votes
1 answer

SetWindowsHookEx ignoring hooks from MS Word

I am trying to catch events when user is typing in Word in my Add-in and I have the following code delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam); [DllImport("user32.dll", CharSet=CharSet.Auto)] static extern IntPtr…
m3div0
  • 1,556
  • 3
  • 17
  • 32
3
votes
1 answer

Horizontal scroll not working mouse_event(MOUSEEVENTF_HWHEEL)

There is no horizontal scroll when I call this method in Delphi 3 under Windows 7: const MOUSEEVENTF_HWHEEL = $1000; mouse_event(MOUSEEVENTF_HWHEEL, 0, 0, 120, 0); Vertical scroll with MOUSEEVENTF_WHEEL works well. Result is same with SendInput, and…
rjobidon
  • 3,055
  • 3
  • 30
  • 36
3
votes
1 answer

Distinguish mice devices from a LowLevel mouse hook

I have a virtual mouse driver and an actual mouse on my computer. I'm using LowLevelMouseProc to capture events windows wide and I would like to not process events from the virtual mouse. I cannot use RawInput as I need to process message of another…
Perfect28
  • 11,089
  • 3
  • 25
  • 45
3
votes
1 answer

CreateFile Hook

I am trying to Create a Hook for CreateFile, so when a process tryies to create a file the hookdll we created will notify the user that: "this process xx.exe trying to create xx.exe, Do you want to proceceed?" So far i am here, So What i need to…
Ismail Dz
  • 67
  • 1
  • 10
3
votes
1 answer

C++ Identifying X Buttons & Scroll Wheel Directions

I have recently been experimenting with a little project during my limited free time to try and gain more experience and understanding with C++, but I've come to a roadblock in my current program: I'm trying to create a global low-level mouse…
Charles
  • 35
  • 1
  • 5
3
votes
3 answers

system-wide hook for 64-bit operating systems

I want to perform a system-wide hook (using SetWindowHook) on a 64bit operating system. I know that 64bit processes (= proc64) can load only 64bit dlls (= dll64) and 32bit processes (= proc32) can load only 32bit dlls (= dll32). Currently I am…
TCS
  • 5,790
  • 5
  • 54
  • 86
3
votes
4 answers

Is there a way for application on Windows 64 bit to execute code both under 64 bit and 32 bit emulation layer?

I am interested whether I can write an application which will be able to call some code without emulation layer and some code inside of 32 bit emulation layer. The main reason for that is that I will need to use API SetWindowHook and I want to set…
Victor Ronin
  • 22,758
  • 18
  • 92
  • 184
3
votes
4 answers

How lock CTRL+ALT+DEL using SetWindowHookEx api?

Good afternoon, I need lock CTRL+ALT+DEL combination using SetWindowsHookEx and today i have done a code and don't is working until now. This code is executing in a dll ( this dll is my software ) that is injected in other process. So, how i can…
user6828073
3
votes
1 answer

SetWindowsHookEx WH_MOUSE freeze on breakpoint in Win7

helos, on WinXP my application has been sucessfully using a global mousehook to retrieve mouseposition and clicks even if it does not have the focus. the hook is in a separate .dll and is being initialized like this (in…
joreg
  • 247
  • 1
  • 2
  • 13
3
votes
2 answers

Clipboard updated event fired multiple times

I am trying to make a global multi value Clipboard. I have used a stack to store the values. I am using WinProc() to capture the global Copy operation where I push the value on stack. Similarly I am using a windows keyboard hook to capture the…
ResVict
  • 312
  • 2
  • 12
1 2
3
16 17