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

WH_MOUSE_LL hook, avoid getting useless WM_MOUSEMOVE events

Is there a way, even a dirty hack, to avoid receiving WM_MOUSEMOVE events in a WH_MOUSE_LL hook? I'm interested only in wheel rotations and buttons. The performance cost of receiving WM_MOUSEMOVE is unnacceptable in my scenario. I cannot use…
Lorenzo Pistone
  • 5,028
  • 3
  • 34
  • 65
0
votes
1 answer

C++ using SetWindowsHookEx only works with strange vcl code added to it. in BCB2009

I have a strange situation using SetWindowsHookEx I have a bcb 2009 project with a form and a Memo on it. in the create we load the Dll and attach the function handler's to both sides. The idea is that when the key board is hit a message appear in…
Joch
  • 13
  • 1
  • 6
0
votes
2 answers

Bizarre hook behavior 32/64 bit

I'm using a local hook (WH_KEYBOARD) with ms word (OpusApp). Well, as far as I know a 32bit app with a 32bit DLL must work only with 32bit target applications. The weird thing is that the program only works with 64bits apps!!! That is it, only with…
sgm
  • 196
  • 3
  • 14
0
votes
1 answer

CreateProcessWithDLLEx-Hooked process starts but can't resume

Im trying to get a basic hook going using microsoft detours. My program is able to successfully run CreateProcessWithDllEx and inject a dll. However, I cannot seem to resume the actual hooked program. I am using notepad for testing and I can see…
emist
  • 137
  • 1
  • 2
  • 8
0
votes
1 answer

KeyHook in another thread

In my C# app I want to do the keyhook but so, that the method invoked when the key is pressed is invoked in another thread. In this way it will not happen, that a key is omitted by my program, because my application was busy with something else. How…
-1
votes
1 answer

Detecting MessageBoxes created by 3rd party DLLs

I'm loading 3rd party DLLs and sometimes they open MessageBox windows that stops the flow of the application, I want to be able to detect when such thing happens. I'm trying to use SetWindowsHookEx with WH_CBT but my callback does not get called. I…
kambi
  • 3,291
  • 10
  • 37
  • 58
-1
votes
1 answer

How to set SetWindowsHookEx only on a specific window to listen for mouse left button up events

I am trying to get when the left mouse button up is hapenning on a specific window. So I googled and find an interesting code snippet here. That code snippet detects in which window the mouse click was done so i could modify a little to make it…
Willy
  • 9,848
  • 22
  • 141
  • 284
-1
votes
1 answer

How global SetWindowsHookEx manages to inject dll into all threads?

I created 2 hooks in my host application. 1st is WH_MOUSE set specifically for Taskbar's thread. 2nd is global WH_KEYBOARD_LL hook (dwThreadId is set to 0). As you can see in Process Explorer, the "local" hook actually injected my dll into specific…
ScienceDiscoverer
  • 205
  • 1
  • 3
  • 13
-1
votes
1 answer

C++ DllInjection / Run dll in sandobxed enviroment (Hooking system/WinAPI calls)

So I have a native Windows dll witch is heavily obfuscated, so disassembling is not an option. If I call a specific function in the dll, the dll does some stuff in my registry, reads a few files and finally returns something. I want to hook up the…
Hexception
  • 722
  • 10
  • 25
-1
votes
2 answers

How to call fuction-pointer from SetWindowsHookEx callback

I tried to call a function-pointer from a dll that hooks the WM_LBUTONDOWN or WM_TOUCH message on all windows displayed at screen. I have the following dll source code: typedef void (*PtrFonct)(int nCode, WPARAM wParam, LPARAM lParam); PtrFonct…
CyrilleH
  • 3
  • 3
-1
votes
1 answer

Unhooking a hook set with SetWindowsHookEx more than once crashes the hooked process

I am trying to hook the keyboard and mouse events of a target application. I followed the SO question How to hook external process with SetWindowsHookEx and WH_KEYBOARD, and the hooks are installed and uninstalled correctly the first time. However,…
-1
votes
2 answers

Keep HOOK running

I am trying to set hook on keyboard with SetWindowsHookEx and I want the program to keep running so I added while(TRUE) after the hook setted. int main() { SetHook(); while (TRUE) { } return 0; } Now, this is not working for me…
-1
votes
1 answer

How to know if a button from another application is clicked or not

I need to automate a task with AutoIt script. Target application is "YTD Video downloader". It has a download button. When i click this button, i need my autoit script to start. After a few hours of googling, i understand that i need to use…
Vinod KC
  • 29
  • 2
  • 9
-1
votes
1 answer

DllMain DLL_PROCESS_DETACH and GetMessage Function reentrancy

I have written a global hook that hooks using SetWindowsHookEx the WH_GETMESSAGE, WH_CALLWNDPROC and WH_CALLWNDPROCRET. The hook dll creates a new thread in the hooked process, which, among other things, checks the audio state of the process and…
Roland Pihlakas
  • 4,246
  • 2
  • 43
  • 64
-1
votes
1 answer

HookProc getting called only few times

I have set a WH_KEYBOARD_LL hook to monitor keystrokes the code works fine for a while but suddenly stops tough the application does not give any single error. I started debugging it and the behaivour appeared sooner while having a breakpoint in the…
opc0de
  • 11,557
  • 14
  • 94
  • 187
1 2 3
16
17