if Screen.ActiveForm Application.MainForm then // There is an opened Window which is not the MainForm
Taken from here.