Creating the Application Object

The procedure for creating the application object differs slightly from language to language. Below are some examples for creating the QuickTest Application object and starting QuickTest in visible mode, using different programming languages.

Visual Basic

The example below can be used only after setting a reference to the type library. If you are not working in a development environment that allows referencing type libraries create the Application object as described for VBScript below.

Dim qtApp As QuickTest.Application ' Declare the application object

Set qtApp = New QuickTest.Application ' Create the application object

qtApp.Launch ' Start QuickTest

qtApp.Visible = True ' Make it visible

VBScript

Dim qtApp

Set qtApp = CreateObject("QuickTest.Application") ' Create the application object

qtApp.Launch 'Start QuickTest

qtApp.Visible = True ' Make it visible

JavaScript

var qtApp = new ActiveXObject("QuickTest.Application"); // Create the application object

qtApp.Launch(); // Start QuickTest

qtApp.Visible = true // Make it visible

Visual C++

#import "QTObjectModel.dll" // Import the type library

QuickTest::_ApplicationPtr spApp; // Declare the application pointer

spApp.CreateInstance("QuickTest.Application"); // Create the application object

spApp->Launch();// Launch the application

spApp->Visible = VARIANT_TRUE; // Make it visible

No comments: