'
' -----------------------------------------------------------------------------
' QWindow Tools Text Documentation May 3rd, 2007 Jacques
' Get Handle, ClassName, WindowText, Childs, Parent
' -----------------------------------------------------------------------------
' For all examples:
' ----------------
' $Include "QWindowTools.Inc"
' Dim myWndTools As QWindowTools
'
' Example 1 Get a list of all Windows
' ---------
' myWndTools.GetChildsList (0)
' ' 0 = all Windows and all their ChildWindows
' ' Use any Window Handle instead of '0' to only get the ChildWindows of that Window
' ' the result is in String Property: myWndTools.Result one Child per line
' ' and in QStringList Property: myWndTools.lstResult one Child per Item
' ' for both the format is:
' ' count<separator>handle,hParent1,hGrandParent, ...<separator>ClassName<separator>WindowText
' ' the separator is the Stringproperty myWndTools.Separator set to Chr$(0)
' ' by default
' RichEdit1.Text = myWndTools.Result
' ' or
' For i = 0 To myWndTools.lstResult.ItemCount - 1
' Print myWndTools.lstResult.Item(i)
' Next i
' ' Using Field$ RapidQ Command, it's possible to extract, all stored infos:
' hWnd = Val(Field$( Field$(.lstResult.Item(i), Chr$(0), 2) , ",", 1))
' hParent = Val(Field$( Field$(.lstResult.Item(i), Chr$(0), 2) , ",", 2))
' ClassName = Field$(.lstResult.Item(i), Chr$(0), 3)
' WindowText = Field$(.lstResult.Item(i), Chr$(0), 4)
' ' but this is easier with the methods decribed here under
'
' Example 2 Search a Window with a part of its ClassName
' ---------
' myWndTools.SearchCaseSensitive = True ' False by default
' myWndTools.SearchInClassNames ("Your Search Text") ' ie: "Expl" for Explorer
' ' Any Window whose ClassName includes the "Your Search Text" will be added
' ' to myWndTools.lstFound, a QStringList property; each Item will have the
' ' format: ChildHandle<separator>ParentHandle<separator>ChildClassName<separator>ChildWindowText
' ' The separator is the String Property myWndTools.Separator set to Chr$(0)
' ' by default.
' For i = 0 To myWndTools.lstFound.ItemCount - 1
' Print myWndTools.lstFound.Item(i)
' Next i
' ' There is a Method to Decode a found Window to the following Properties :
' For i = 0 To myWndTools.lstFound.ItemCount - 1
' myWndTools.DecodeFoundItem (myWndTools.lstFound.Item(i))
' Print " myHandle: ";myWndTools.ChildHandle
' Print "myParentHandle: ";myWndTools.ParentHandle
' Print " myClassName: ";myWndTools.ChildClassName
' Print " myWindowText: ";myWndTools.ChildWindowText
' Next i
'
' Example 3 Search a Window with a part of its WindowText (Often the Window Caption)
' ---------
' myWndTools.SearchCaseSensitive = True ' False by default
' myWndTools.SearchInWindowTexts ("Your Search Text") ' ie: "Microsoft Internet Explorer"
' ' Any Window whose WindowText includes the "Your Search Text" will be added
' ' to myWndTools.lstFound QStringList property; each Item will have the
' ' format: ChildHandle<separator>ParentHandle<separator>ChildClassName<separator>ChildWindowText
' ' The separator is the String Property myWndTools.Separator set to Chr$(0)
' ' by default.
' For i = 0 To myWndTools.lstFound.ItemCount - 1
' Print myWndTools.lstFound.Item(i)
' Next i
' ' There is a Method to Decode a found Window to the following Properties:
' For i = 0 To myWndTools.lstFound.ItemCount - 1
' myWndTools.DecodeFoundItem (myWndTools.lstFound.Item(i))
' Print " myHandle: ";myWndTools.ChildHandle
' Print "myParentHandle: ";myWndTools.ParentHandle
' Print " myClassName: ";myWndTools.ChildClassName
' Print " myWindowText: ";myWndTools.ChildWindowText
' Next i
' ' Properties ChildHandle, ParentHandle, ChildClassName, ChildWindowText
' ' are only used by method DecodeFoundItem. Each call of method
' ' DecodeFoundItem overwrites the previous decoded properties.
'
' OTHER USEFULL METHODS
' ---------------------
' DefStr sClassName = myWndTools.GetClassName (hWnd)
' DefStr sWindowText = myWndTools.GetWindowText (hWnd)
' ' Are easier to use than their equivalent API
' -----------------------------------------------------------------------------
'