How does software like Spy ++ get information?

I am working on test automation software. To make it work, you need to "look" at the desktop and all open windows. He needs to know which windows are open and what controls they consist of. Therefore, it should do something similar to what Spy ++ does (Spy ++ from Visual Studio). Does anyone know how Spy ++ gets all the information? Are there any Windows methods that you can call to get information about open windows?

+3
source share
2 answers

You can use EnumWindows to get all top-level windows. In lpEnumFuncyou can call FindWindowEx to get the child windows / controls of each top-level window, and then any other interesting function that gives you the necessary information, such as GetClassName , GetClassInfo , GetClientRect , etc. Look here for more.

+8
source

He called windows hook . Checkout Win32 API SetWindowHookEx .

, DLL DLL- Windows Windows .

. Windows hooks.

+4

Source: https://habr.com/ru/post/1706661/


All Articles