You can test whether the form is displayed on the screen by calling the fm_isup() function:
long fm_isup(dfmp) DFORMPTR dfmp; /* Data form to test */
fm_isup() returns a non-zero value if the form is displayed on the screen. 0L is returned if the form is not displayed.