Using dynamic find() when recording in a Notepad or Windows application

You can adapt the dynamic find() API in the Microsoft .NET integrated development environment (IDE) to obtain properties of the application under test when recording in Notepad or in a Windows platform application.

This example shows you how to use the GetRootTestObject() method when recording in Notepad or in a Windows application.
Public Function TestMain(ByVal args() As Object) As Object
        ' TODO Insert code here
        ' Dim processNotepad As ProcessTestObject
        ' processNotepad(StartApp("notepad"))

        Dim root As RootTestObject
        root = GetRootTestObject()

        'Array to hold Property 
        Dim properties(1) As Rational.Test.Ft.Script.Property
        'The Property
        Dim prop1 As Rational.Test.Ft.Script.Property

        prop1 = New Rational.Test.Ft.Script.Property(".class", "Edit")
        'Storing property to the array
        properties(0) = prop1
        'Test Object array
        Dim candidates() As TestObject
        'Doing find and saving the returned object in the test object arrary.
        candidates = UntitledNotepadWindow().Find(AtChild(".class", "Edit"))
        'If the root.Find()is used, it will be extremely slow in finding the object
        'candidates = root.Find(AtDescendant(".class", "Edit"))

        If (candidates.Length> 0) Then
            'Defining a GUI test object.
            Dim edit As TextGuiTestObject
            'Assiging the first found test object to the TestGuiTestObject.
            edit = candidates(0)
            'Calling method on the testobject.
            edit.SetText("I was set using Find api")
        Else
            LogInfo("No object was found")
        End If
        LogInfo(candidates.Length)
        UnregisterAll() 'This is VERY important when Find() API is used.

    Return Nothing
    End Function
End Class