I'm working on a software for test automation. To get it working it need's to "have a look" on the desktop and all open windows. It needs to know which windows are open and what controls they consist of. So it has to do something similar to what Spy++ is doing (Spy++ from Visual Studio). Does anyone know how Spy ++ get's all the information ? Are there any Windows Methods one can call to retrieve information about open windows ?
+5
A:
It's called a windows hook. Checkout the Win32 API SetWindowHookEx.
There are different types of hooks, they reside in a DLL and that DLL function is called by Windows for the type of windows messages of a specific thread or all threads in the same desktop.
Please also see my related answer on Windows hooks here.
Brian R. Bondy
2009-04-19 06:32:49
thanks anyway, those hook's are "the other big thing" i need ...
FunnyBoy
2009-04-19 07:53:58
+6
A:
You can use EnumWindows to get all top level windows. Within the lpEnumFunc
you can call FindWindowEx to get child windows/controls of each top level window and then any other interesting function that gives you information you need, e.g. GetClassName, GetClassInfo, GetClientRect etc. etc. Take a look here for more
porkchop
2009-04-19 07:26:31
+1
A:
I found a blog in the issue on http://blogs.msdn.com/vcblog/archive/2007/01/16/spy-internals.aspx
/L
leiflundgren
2010-01-14 15:19:02