1. Refer to : http://msdn.microsoft.com/en-us/magazine/cc163288.aspx
2. Tools: MS Spy++
3. Key MS Library: UIAutomationClient.dll & UIAutomationTypes.dll
4. Required Preperation: Before debugging you should turn off the managed Debugging Assistant for the "NonComVisibleBaseClass" exception. In Visual Studio,
1. Navigate to Debug->Exceptions...
2. Expand "Managed Debugging Assistants"
3. Uncheck the NonComVisibleBaseClass Thrown option.
4. Click [Ok]
Sample Demo codes by myself as follows:
-----------------------Form1.cs (server role) ----------------------------------------------
------------------------AutoTestForm1.cs---------------------------------------------