IF VARTYPE(oForm.WindowType) = "N" IF NOT oForm.Caption=='' AND oForm.ShowWindow!=2 AND ; oForm.WindowType!=1 AND oForm.BaseClass=='Form' * hWnd is from some active non top level form, next check button collection to * see ifalready exists a button assigned to it lAddFormOK = .T. FOR EACH oButton IN this.cnt_windows.opg_windows.Buttons IF oButton.formhWnd = hWnd lAddFormOk = .f. EXIT ENDIF ENDFOR ENDIF ELSE IF NOT oForm.Caption=='' AND oForm.ShowWindow!=2 AND oForm.BaseClass=='Form' * hWnd is from some active non top level form, next check button collection to * see if already exists a button assigned to it lAddFormOK = .T. FOR EACH oButton IN this.cnt_windows.opg_windows.Buttons IF oButton.formhWnd = hWnd lAddFormOk = .f. EXIT ENDIF ENDFOR ENDIF ENDIFThe above code was inserting into the first FOR-EACH loop after the first IF-END. It was necessary to check if the WindowType property existed as some of the form handles did not have this property. The above code prevents a modal form from from being added to the taskbar.
lModalWindow = .F. FOR EACH oForm IN _screen.Forms IF VARTYPE(oForm.WindowType)="N" .AND. oForm.WindowType=1 lModalWindow = .T. EXIT ENDIF ENDFOR IF !lModalWindow ... ENDIFThis was added before the FOR-EACH loop (the FOR-EACH loop goes inside the IF-ENDIF). This keeps the control from responding if a form is modal.