Erel's method does work but the result differs between the IDE and the optimised compiler for a pre-defined object. In the IDE the control exists even if it has not been Newed but when optimised it exists only
after being Newed so this following code shows a "Yes" message box and Object appears in the list in the IDE, but optimised compiled there is no Yes message box and Object is absent from the control list.
Code:
Sub Globals
'Declare the global variables here.
Dim Ctls (0)
End Sub
Sub App_Start
'Object.New1
If ObjectExist("Object") Then
Msgbox("Yes")
End If
Ctls() = GetControls("")
For i = 0 To ArrayLen(Ctls())-1
msg = msg & Ctls(i) & crlf
Next
Msgbox(msg)
End Sub
Sub ObjectExist(obj)
ErrorLabel(ObjectExistErr)
Dim a
a = ControlType(obj)
Return true
ObjectExistErr:
Return false
End Sub
EDIT: Note that "Object.New1" is commented out.