Forum Discussion

sarad_rajbhanda's avatar
sarad_rajbhanda
New Contributor
14 years ago

DirectUIHWND in Windows 7

I am doing a simple recording of Windows 7 Explorer where I want to select a folder. In Windows 7, Tree View is captured as SysTreeView32 and List/Folder/Details view is captured as DirectUIHWND. How can I capture items (folders) under DirectUIHWND object? I used Object Spy, On-Screen Action, every other alternatives but I am not being able to perform a simple selection of folder.

P.S. I don't want folder to be selected with x and y co-ordinate values because what if window is re-sized?

Your help is much more appreciated!!!



Thanks.
  • Try to use MSAA plug-in (read "Testing with Microsoft Active Accessibility" help topic). You should add class name of you problematic control (e.g. "DirectUIHWND") to the list of windows that will be shown as MSAA objects. 

    To do this just open "Default Project Properties" dialog, navigate to the "Project -> Open Applications -> MSAA" node, and add class name of your control, which should be recognized as MSAA object (e.g. "DirectUIHWND"). Also note, that "MSAA Open Application" plug-in should be installed.





    Once expanded via MSAA, the "DirectUIHWND" object exposes properties, methods and child objects you can use to work with it.





    In your Object Browser you should see something like that: 





    ...Window("SHELLDLL_DefView", "ShellView", 1).List("Items View").ListItem("$Recycle.Bin")

    ...Window("SHELLDLL_DefView", "ShellView", 1).List("Items View").ListItem("my test file.txt")

    ...Window("SHELLDLL_DefView", "ShellView", 1).List("Items View").ListItem("My_Test_Folder")

    and so on...





    But here you can be faced with the next issue.



    List("Items View") MSAA object shows only visible child objects in the Object Browser tree (e.g. children, with Visible = true). Also List("Items View").ItemCount shows only number of visible children ListItem.





    To find some item, which is not visible on screen, you should do some scroll with mouse wheel on you control, and review the children objects of List("Items View") object.
  • Hello Sarad,


    I recommend that you choose not to use Windows Explorer to work with files as this is really unreliable way. TestComplete supports a number of special scripting objects that will help you accomplish the task. Please refer to the Working With Files From Scripts Help topic for more details.