Code:
    Function Current_View Returns Integer
        Integer Client_Object_Id View_Object_Id
        
        Get Client_id to Client_Object_Id
        
        Get Next_Mdi_Dialog of Client_Object_Id True to View_Object_Id
        
        While (View_Object_Id > 0)
            If (current_scope(desktop)=View_Object_Id) Begin
                If (View_mode(View_Object_Id)<>VIEWMODE_ICONIZE) Begin
                    Function_Return View_Object_Id
                End
            End
            Get Next_Mdi_Dialog of Client_Object_Id False to View_Object_Id
        Loop
        Function_Return 0
    End_Function