The window ( as all containers ) has a property ContainerTarget. This is of type character and contains a comma separated list of handles. You can loop through the list, use the widget-handle function to convert each entry of the list into a handle type and invoke functions like getObjectName and getObjectType on this hanlde. These should get you the types and names and you can branch your logic on them.
On a note: Neither do you say anything about your Progress/OpenEdge version nor do you say something about the framework ( ADM1, ADM2, Dynamics ) you are using. In each of these the term "smart" in conjunction with objects is used. My answer assumes at least ADM2 with a reasonably recent version of OpenEdge.
Heavy Regards, RealHeavyDude.