MFC controls not getting recognized on XP machine

Problem Description:

Recently got an issue where after migration of the VC++6.0 application to VC++10.0, controls were not getting recognized  by CodedUI test builder tool.

 

Resolution:

  1. In this kind of scenario, first check if the Inspect tool is able to recognize the control or not.

             You can download Inspect tool from Windows SDK.

             More info for Inspect

             msdn.microsoft.com/en-us/library/dd318521(VS.85).aspx

        2. If inspect tool also throws the error in recognizing the controls, then definitely this is not an error with CUIT product.

        3. Though, MFC controls uses MSAA technology by default for identification of the controls, still check if Inspect tool is able to recognize them using UI Automation, this actually was the case in the scenario which I was troubleshooting.

        4. If controls are getting recognized by UIA, then you need to enforce CUIT to use UIA instead of MSAA for identification of MFC controls.

        5. There is no direct way to perform steps 4, you need to write a plug-in for the same, please refer below blog which has the sample:

               blogs.msdn.com/b/thejs_blog/archive/2011/05/17/modifying-technology-used-for-identifying-control.aspx

        6. You need to modify the sample for the controls, check the class name for the controls and put a condition for that class to use native support in the sample.

 
               With the above steps, I was able to resolve the issue. Hope this would help.

 

 

Content developed by: Deepak Mittal
 
Content reviewed by: Teodora Stanev