parrowdice
parrowdice

Reputation: 1942

Stop application stealing input

I have a third party application (I'll call it GreedyApp for brevity), which holds the mouse and keyboard input hostage when its window gets focus i.e. it hides the standard mouse cursor and replaces it with it's own cursor, and confines the cursor to its window. The only way to get input to other windows is to ALT+TAB away from GreedyApp.

I need to allow the user free use of all of the components of the system (the delivered system will be purely touch-screen), so at the minute the rest of the system becomes unusable once GreedyApp gets focus.

So far, I've hijacked user32.dll for GreedyApp, hooked SetCursor, ShowCursor and ClipCursor, and disabled them. The result is that GreedyApp no longer hides the cursor, and the cursor is free to roam wherever the user moves it, but...

The problem I'm left with, is that no matter where on the screen the cursor is pressed, or what keys on the keyboard are pressed (except ALT+TAB), the input is still directed into GreedyApp, and other windows don't receive any input.

I'm not sure how GreedyApp is achieving this, and therefore I don't yet know which API calls to hook to stop it. I though it might have been using hooks itself, but I've hooked and disabled SetWindowsHookEx, but the problem persists.

So my question is this:

Either:

A) Is there a (relatively straight-forward) way to find out what API calls an application is making at runtime?

or

B) What method is GreedyApp likely to be using to stop other windows from receiving input?

Upvotes: 1

Views: 1231

Answers (1)

parrowdice
parrowdice

Reputation: 1942

The application was using RegisterRawInputDevices to get raw mouse and keyboard input, and using the flag RIDEV_CAPTUREMOUSE to stop other applications getting focus.

I've hooked the API call and remove the flag before passing the parameters to the Windows API to process. The user now has control over the system :)

Upvotes: 1

Related Questions