>OK, I guess I did miss something. I don't understand your comment about a window disappearing--or even why the WindowType really matters in this case. I'm looking for an 8 character string of numbers in the caption of a form and it is either there or it isn't, regardless of WindowType. If the string is found, the new form won't be allowed to open. The only real problem that I can see would be if formcount doesn't include toolbars while forms() does.
-
'kay then
FormCount includes Toolbars and _screen.Forms[i] also
Both Forms and Toolbars have Captions
A Toolbar does not have a windowtype property [ but in your case it does not matter I guess]
I always loop backwards through _screen.Forms.
Call it paranoia but better be safe than sorry. If a form gets released for whatever reason, the reference you're holding becomes null instantly
So : obj = _screen.forms[m.i] is an object here, but it may not be a few lines further
If possible - put part of the loop in a try/catch - I would not want any errors there
I have seen the most unlikely things in foxpro. Object code executing (gridcolumn, textbox, ...) whilst the object was being destroyed - some properties were no longer there
Gregory