GDI capture feature
In rare cases, Ranorex Studio can’t identify UI elements of an AUT correctly. This applies to certain technologies such as VB6, MFC, and older Delphi versions. In these cases, you can use the GDI (graphic device interface) capture feature to identify these elements correctly.
The GDI capture feature is part of Ranorex Spy. You can access it from an element’s context menu in the element tree browser.
On this page, we’ll explain the difference between non-GDI and GDI UI-element identification by way of a simple example in the Ranorex Studio Demo Application: the calendar.
Default, non-GDI UI-element identification
We want to automate the calendar in the Demo Application. For this purpose, we need to identify the UI element for a specific day of a month.
Let’s identify the element by using the track function in Spy:
Start Ranorex Spy and click TRACK.
In the Demo Application, click a specific day, e.g. 25 May.
In the element tree, the UI-element also has the adapter type
DateTime(i.e. a calendar).
The screenshot for the UI element also shows the entire calendar, and not just the 25.
Enable GDI capture
As default UI element identification didn’t work in this case, we need to enable GDI capture. To do so, we add the incorrect UI element to the GDI capture list. In our case, this will allow Ranorex Studio to identify the correct UI element based on the RawText adapter class.
In the element tree, select the UI-element you want to be handled by GDI capture.
Right-click it and click Add class name to GDI capture list.
Click OK to confirm the info dialog.
Click a specific day in the calendar, e.g. 25 May.
The UI element is identified correctly based on the RawText adapter .
In the element tree, the UI element has the adapter type
The screenshot now shows the UI element for the specific day instead of the entire calendar.
Add a process to the GDI capture list
We recommend only adding single UI element classes to the GDI capture list. However, if you need to add an entire process (e.g. for legacy reasons), you can do so in the GDI capture settings, which is explained in the next topic.
GDI capture settings
The GDI capture settings display all added processes and class names. This is also where you can add processes and class names in bulk or by specifying a regular expression. You can access the GDI capture settings from the Settings dialog in Ranorex Studio or Spy.
In the General tab, click GDI capture settings….