My@WndTrepanat

 

Using My@WndTrepanat

Let’s imagine that we need to make a script for one little application or one module of a huge application.

First, we will need to understand the GUI of this application. To do this, press the "Capture Window" button and when the needed window is under the cursor, press the Ctrl-A combination. The window controls tree will be populated based immediately and will represent window hierarchy in the same way as Windows "sees" it. My@WndTrepanat can color the tree for ease recognizing.

What is more, the tool builds a 3-D model of the investigated application's GUI which gives you a way to quickly understand the application you need to test.

Using this tool, QA engineers can write more accurate scripts and speed up the process of the tested application investigation.

 

How My@wndTrepanat works

Why you need it

My@WndTrepanat builds its tree in the same way as MS Spy does it. To make the understand of the application more easy, My@WndTrepanat can color the tree based on the parent-child depth level. Thus, even huge trees are not more difficult to read and understand.

The unique feature of building a 3-D model, provides just more power in addition to what you already have. Like a surgeon you can go deep inside any Win32 application. Let's illustrate this in action.

Let's start

Run My@WndTrepanat and press “Capture window”: the tool will switch in the mode of capturing target windows. Every window over which you move the cursor, will be highlighted with a black border so that you can easily identify its boundary. When you find the needed window, press Ctrl+A. The toll will build the tree of the application controls. Try to color it by checking the “Use colored draw” checkbox.

3-D model of applications

Now, press the “Build“ button and you will see a 3-D model representing your application. This model is interactive. Try to click rectangles of different controls.

Once you click a rectangle, the tree will highlight the corresponding tree item and otherwise.

Start trepanation

Now, let's check what is inside our application. We suggest that you select a Win32 application with a lot of visual controls. Once you capture it, prepare its 3-D model using the Build button. Activate the “Hide window in structure” checkbox. Then click controls placed on the top. The tool will immediately show you what is under them, which allows you to understand the GUI of the application better. If you want to get the hidden window rectangles back, press the "Recycle bin" button.

Navigate application insides

Pay attention to the “Show invisible window” checkbox. It is active by default which may lead to situations when you don't recognize a well known windowwhen capturing. Just uncheck it to see windows as they are. This feature allows you to find interesting parts of the test windows that were unknown to you previously.

The “Highlight real window” checkbox will force the tool to highlight the actual window located in your tested application when you select a tree element. This is also useful to understand specifics of your application GUI more easy.

 

To pleasure for users of TestComplete (AutomatedQA corp.)

For those who use TestComplete, My@WndTrepanat offers a great tool to make searching of different graphic elements as easy as possible. It is useful when you work with application that consist mostly of non non-windowed graphic elements. In particular, this feature visualize how the Regions.Find function works.

The best example when you can see the advantage of this functionality is try it with Adobe PhotoShop. This graphic editor uses a huge number of non-windowed graphic controls. To start working, prepare a small graphic file which contains the image of the investigated element. For example: the image of a button. Open the prepared graphic file and you will see the result of the TestComplete's Regions.Find function in action.

 

How to find windows using the TestComplete

Well known that TestComplete 3 may fail to find the target window. Using TestComplete it is possible to find the target window for certain only when it has a unique class and Caption. If there are several windows with identical classes and captions, TestComplete will suggest to use window Index to access the needed window object.. For example: w.Window ("SameClass", "SameCaption", 23).

The cause of this that TestComplete 3 builds the windows tree incorrectly.  

To help you avoid this problem, My@WndTrepanat includes a specail plug-in for TestComplete 3.

 

The MyPlugin plug-in.

Install the MyPlugin4TC3.pls plug-in in TestComplete. This plug-in will give you access to the MyTCObject object with 3 functions:

MyTCObject.GetChildWindow (hWnd: integer): hWnd
MyTCObject.GetParentWindow (hWnd: integer): hWnd
MyTCObject.GetWindowChildList (hWnd: integer): hWnd

Here is a sample procedure that searches for a child window starting from its parent-window. Forget about window indexes using this feature!

Function SearchObject(wSource : OleVariant; SrchClass, SrchCaption : String) : OleVariant;
var
  w: OleVariant; 
  CurWnd, i, SourceWnd, ChldCount: integer; 
begin
  SourceWnd := wSource.Id; 
  ChldCount := MyTCObject.GetWindowChildList(SourceWnd); 

  i := 1; 
  while i <= ChldCount do
  begin
    CurWnd := MyTCObject.GetChildWindow(SourceWnd,VarToInteger(i)); 
    w := Sys.WindowFromHandle(CurWnd); 
    if VarType(w)<> VarEmpty then 
      if ((Pos(SrchCaption,w.wndCaption)>0) or (SrchCaption = w.wndCaption)) 
           and (Pos(SrchClass,w.wndClass)>0) then 
      begin
        Result := w; 
        break; 
      end; 
    Result := nil;

    inc(i); 
  endif Result = nil then
  begin
    Log.CreateNode('Search Object'); 
    if VarType(wSource) <> varEmpty then 
      Log.Message('Source object = ' + wSource.Name); 
      Log.Message('SearchObject', 'SrchClass - ' + SrchClass + ' ; SrchCaption - ' + 
                        SrchCaption, pmHigh, 2, clBlack); 
      Log.CloseNode; 
  end; 
end;