(by all mean do re-tag with the relevant technology: I don\'t know which ones they are :)
I\'ll probably come later with more detailed questions, about spec
I remember back in 2006 there was a utility WinObj as part of sysinternals that possibly did what you want. Part of these utilities were provided with source code by author (Mark Russinovich).
Since that time, his company was bought by Microsoft so I do not know whether the source would be still available.
Also the following may be worth checking:
http://msdn.microsoft.com/en-us/library/aa264396(VS.60).aspx
http://www.codeproject.com/KB/dialog/windowfinder.aspx