Saturday, June 11, 2011

QTP DotNet Factory Example

Set var_CreateInstance = DotNetFactory.CreateInstance("System.Windows.Forms.Form", "System.Windows.Forms")

var_CreateInstance.Show

wait 2

var_CreateInstance.Close

The following example uses the CreateInstance method to create an instance of a system environment object, and to display a message box listing the current directory. In this example, there is no need to specify the optional arguments because the required assembly is already in memory.

Set var_CreateInstance = DotNetFactory.CreateInstance("System.Environment")
msgbox var_CreateInstance.CurrentDirectory

No comments:

Post a Comment