See the question and my original answer on StackOverflow

I suggest you use UI Automation to manipulate another application's window.

This is probably the best way to ensure your manipulating application will not be seen as malware, as UI Automation is 100% part of the OS, not a HACK, supports security. It also application authors to add or remove automation capabilities to their application. See this somewhat related thread here on SO: https://stackoverflow.com/questions/5383600/win32-vs-ui-automation