Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


How to Differentiate between Two Child Windows with Same Name

Keywords: 	  differentiate child windows

Question:

How can I differentiate two windows with exactly the same name, the same ID and the same class?

I have used the windows analysis script to run on my program.

Answer:

Here is some code that might help.
LookingFor="Open Initial Conditions"
list=WinItemNameId( )
listcount=ItemCount(list,"|")

ID1=""
ID2=""
IDX=1

for xx=1 to listcount by 2
   thisname=ItemExtract(xx,list,"|")
   thisid=ItemExtract(xx+1,list,"|")
   ;Pause("",strcat(thisname,@crlf,Lookingfor))
   if thisname == LookingFor
      ID%IDX% = thisid
      IDX=2
   endif
next

Message(ID1,ID2)

;Now we have the ID's of the two windows.
; now we have to tell which is which.
ID1List=WinItemChild(ID1)
ID2List=WinItemChild(ID2)

Message(ID1,ID1List)
Message(ID2,ID2List)

;Lets see which one has "Initial Condition Files"

childwin="InitialConditionFiles"   ; Window with this is the ICF window
                                   ;the other is the LI window (Look In)

if strindexnc(ID1List,childwin,0,@fwdscan)!=0
   ICFWIN=ID1
   LIWIN=ID2
else
   ICFWIN=ID2
   LIWIN=ID1
endif

;Now use IDFWIN and LIWIN instead of the window titles for the DllHwnd

Article ID:   W12510
Filename:   How to Differentiate 2 Child Windows with Same Name.txt