Can a particular window observe messages received from the program side?

Asked 2 years ago, Updated 2 years ago, 49 views

Obtain a specific window handle from the C# program and
The window receives messages from the operating system via mouse and other operations. I would like to check on the program, is it possible?

Specifically,
message that can be checked using spy++ I want to get it from the program.

As an image, we expect to be able to retrieve the following message information:

PWM_MOUSEMOVE fwKeys:0000xPos:504yPos:414
PWM_MOUSEMOVE fwKeys: 0000 xPos:505 yPos:414
PWM_MOUSEMOVE fwKeys: 0000 xPos:508yPos:414

Thank you for your cooperation.

c# windows

2022-09-30 19:13

1 Answers

Not possible from C#.

Windows offers the Hook feature, which allows you to hook when a window receives a message using the WH_GETMESSAGE hook.
However, the Hook feature is not available because the entire Windows is running with native code and the Hook feature requires native code, whereas the C# language is running with managed code on the .NET Framework.
Consider using a C++ language and more.


2022-09-30 19:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.