????????????????????????????Focus??????????????????????????з??????????????????

    '############################################################################
    '#  Function A_Focus(strCaption as String) as Integer
    '# DESCRIPTION:
    '#      Focus object
    '# PARAMETERS:
    '#      [In]    strCaption e.g.??"CPN_DESKTOP"
    '# RETURNS:
    '#      true success
    '#      false fail  
    '# ERRORS:
    '#       (none)
    '# EXAMPLES:
    '#      return = A_Focus("CPN_DESKTOP")
    '# Orig Author: XX)
    '# Orig   Date: May 09?? 2005
    '# History:
    '#      May 09?? 2005    Original Release
    '#      Apr 17?? 2006    XX    If the window state is minimized?? then restore the position.
    '############################################################################
    Function A_Focus(strCaption as String) as Integer
        Dim Result as Integer
        Result=SQAWaitForObject(";type=window;Caption=" &strCaption?? 20000)
        If Result<> sqaSuccess Then
           A_Focus= false     
           Exit Function
        Else
           ' If the window state is minimized?? then restore it.
            Dim state As String

            result = SQAGetProperty(";type=window;Caption=" &strCaption?? "WindowState"?? state)
            ' Valid WindowState:
            ' 0 : Normal
            ' 1 : Minimized
            ' 2 : Maximized
            If (state = "1") Then  
                Window SetContext?? "Caption=" &strCaption ?? ""
                Window RestorePos?? ""?? ""  
            End If

            A_Focus= true  
            Window SetContext?? "Caption=" &strCaption ?? ""
        End If  
    End Function

    '############################################################################
    '#  Function A_WaitWindowAppear(caption As String?? Optional Timeout As Variant)  As Integer
    '# DESCRIPTION:
    '#      Wait for the object to appear
    '# PARAMETERS:
    '#      [In]    caption      caption title
    '#      [In]    Timeout      time out
    '# 
    '# EXAMPLES:
    '#      result = A_WaitWindowAppear("Type=CheckBox;WindowIndex=19")
    '# Orig Author: XX
    '# Orig   Date: Apr 05?? 2006
    '# History:
    '#      June 08?? 2005    Original Release
    '############################################################################
    Function A_WaitWindowAppear(caption As String??Optional Timeout As Variant) As Integer
           
        If A_WaitForObject(";Type=window;Caption=" & caption??Timeout) = sqaSuccess Then
             A_WaitWindowAppear = True
             Window SetContext?? "Caption=" &caption ?? ""
             Exit Function
        Else
             A_WaitWindowAppear = false
             SQALogMessage sqaWarning?? "Caption [" & caption & "] has not appeared" ?? ""
        End If     

    End Function

    '############################################################################
    '#  Function A_WaitWindowDisappear(recMethod As String?? Optional Timeout As Variant)  As Integer
    '# DESCRIPTION:
    '#      Wait for the Window to disappear
    '#
    '# EXAMPLES:
    '#      result = A_WaitWindowDisappear("Type=CheckBox;WindowIndex=19")
    '# Orig Author: XX
    '# Orig   Date: June 08?? 2005
    '# History:
    '#      June 08?? 2005    Original Release
    '############################################################################
    Function A_WaitWindowDisappear(recMethod As String?? Optional Timeout As Variant)  As Integer
        A_WaitWindowDisappear = A_WaitObjectDisappear(";type=window;Caption=" & recMethod?? Timeout)
    End Function