Drawing a rectangle on the screen with Win32 API methods (Extern)

In this recipe, you will also see an example of how to use the Extern reserved object to define references to methods in external DLLs such as those of the Win32 API. These methods can then be loaded and executed during runtime. We have already seen an example of this in the Reading values from an INI file recipe in Chapter 1, Data-driven Tests. Here, we will learn how to implement a function that draws a rectangle on the screen with the color of your choice. This is useful to mark areas on the screen that are of interest (especially when the test fails) and hence, makes the report analysis task more efficient.

Getting ready

From the File menu, navigate to New | Test, or use the ...

Get Advanced UFT 12 for Test Engineers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.