This is what i used to use (before i retired

)
if is_this_window_open( cWindowName )
return(nil)
endif
***************************
function is_this_window_open( cWindowName )
***************************
local lRetval:=.f.,i
local oMainwindow:=SetAppwindow()
local nDeskTopWindows := Len(AppDeskTop():childList())
local nChildWindows,aChildList
// added in case oMainwindow does not have drawing area
IF !ismembervar(oMainWindow,"drawingarea")
return(lRetval)
ENDIF
nChildWindows := Len(oMainWindow:drawingarea:childList())
aChildList := oMainWindow:drawingarea:childList()
IF (nDesktopWindows >2 .OR. nChildWindows>1) .AND. !Empty(cWindowName)
FOR i := 1 TO nChildwindows
IF ismembervar(aChildList
,"title")
IF aChildList:title == cWindowName
err_msg("Cannot open "+cWindowName+" twice")
SetAppFocus(aChildList)
lRetVal := .t.
EXIT
ENDIF
ENDIF
NEXT
ENDIF
return(lRetval)