I'm wondering if there is a way to define a window, which is unique.
I used window("xxx","*",index_value) to define a window. If there pops up another floating promptdialogbox, the index_value will be changed to index_value+1. Then the window will not be recognized by tc.
So what should i do next?
So, some windows in your test application cannot be identified uniquely using the "WndClass, WndCaption, Index" model, because their indexes are not stable and can change. In this instance, you need to use information about windows' content to distinguish among them. TestComplete allows you to use properties of the object's children to identify it. You can recognize objects by their children in the following two ways:
1. Using the Name Mapping feature.
Map windows that you need to recognize. Go to the Mapped Objects panel and open the Required Children tab page to the right of it and specify child objects and their properties you wish to use to identify the windows. You can find the detailed instructions in the following help topic: Specifying Child Objects Required for Mapped Object Identification
2. From a script, using the FindChild method.
This method searches for a child object of the given object by values of the specified properties. Please see the method description and a sample script with Notepad here: FindChild Method
So, in your script, you could iterate through all the windows with the needed WndClass and WndCaption properties and check children of each window to find the one containing the needed child objects.