name22

Process Get Windows

Jun 9th, 2012
134
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Array.au3>
  2. #include <Process.au3>
  3.  
  4. GUICreate("Test1", 100, 100)
  5. GUICreate("Test2", 100, 100)
  6. GUICreate("Test3", 100, 100)
  7. GUICreate("Test4", 100, 100)
  8. GUISetState()
  9.  
  10. $aResult = _ProcessGetWindows("Autoit3.exe")
  11. _ArrayDisplay($aResult)
  12.  
  13. Func _ProcessGetWindows($sProcessName)
  14.     $aWinList = WinList()
  15.     $sWindowsFound = ""
  16.     For $i = 1 To $aWinList[0][0]
  17.         If _ProcessGetName(WinGetProcess($aWinList[$i][0])) = $sProcessName And $aWinList[$i][0] <> "" Then $sWindowsFound &= $aWinList[$i][0] & '|'
  18.     Next
  19.     If $sWindowsFound = "" Then Return -1
  20.     Return StringSplit(StringTrimRight($sWindowsFound, 1), "|", 2)
  21. EndFunc   ;==>_ProcessGetWindows
RAW Paste Data