Forum Discussion
tristaanogre
14 years agoEsteemed Contributor
The thing is, the Name property you are using IS using both the class and the caption so you're not really getting anywhere with that.
WndCaption and WndClass are only examples. You can use the Find method with any combination of properties. The key is to use a set of properties that will uniquely identify the component you're looking for. Again, caption, index and name (because name includes both caption and index) are unreliable for unique identification if they are subject to frequent changes.
You can use the wildcard on the caption, but as you noted, that will return more than one potential object since the index is different. You CAN use the index if you can be assured that the object will ALWAYS have index 8. In my experience, that is very hard to nail down so I avoid using the index as a search parameter.
WndCaption and WndClass are only examples. You can use the Find method with any combination of properties. The key is to use a set of properties that will uniquely identify the component you're looking for. Again, caption, index and name (because name includes both caption and index) are unreliable for unique identification if they are subject to frequent changes.
You can use the wildcard on the caption, but as you noted, that will return more than one potential object since the index is different. You CAN use the index if you can be assured that the object will ALWAYS have index 8. In my experience, that is very hard to nail down so I avoid using the index as a search parameter.