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).

  • You question is a good example of asking for a way to achieve something specific without stating the underlying problem. When reading your question one has to wonder if not one of several available paths would be more applicable than what you have chosen as the right path for yourself. Perhaps you could amend your answer to include the actual problem statement as well ...
    – 0xC0000022L
    May 14, 2021 at 20:35

1 Answer 1


Once messages are dispatched to the application, it is the architecture of each application 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 believe 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.

  • I think a mention of UIPI would be in order in the days of Windows Vista and newer 😉
    – 0xC0000022L
    May 14, 2021 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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