Where do mouse-clicks in a program's GUI window/menus (Windows OS) get stored in memory? Is there some sort of input/GUI "queue" similar to Windows messages queuing?

I'm wondering if it'd be possible to manually manipulate these queues, for example, to make a program (or the OS) think that an item or coordinate was mouse-clicked when it wasn't (physically).


Once messages are dispatched to the application, it is the architecture of each applicativo that determines the processing.

Certain applications create queues, others directly dispatch the message directly. The latter is more common.

Ideally, you could directly call the message pump with your messages, this way you can make the application belive that certain events have occurred.

Depending on the application, this could work. However, the problem is that once the application receives your fake messages, it could require additional information from the environment and the processing might not go as expected.

For example, suppose you inject a mouse event, and the application also checks the state of the keyboard via GetAsyncKeyState, then you won't be able to go further on the processing because you cannot fake easily the state of the keyboard if not by hooking the API too.

A better approach is to stimulate the user interaction via SendMessage (which however had the same problem with async checks) or with SendInput.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.