Zisly Posted July 1, 2009 Share Posted July 1, 2009 (edited) Hello, I made a little function which I to find the title of a process windows. expandcollapse popup;=============================================================================== ; ; Description - Returns a string containing the title of a window title of a process ; Syntax - _ProcessGetWinTitle($SProcess,$bM) ; Parameters - $SProcess = Process name ; $bM = If set to true and there are multiple windows it will return ; an array with all titles else it will just return the last active window ; Requirements - None. ; Return Values - Success - The title ; Success - if $bM is set to true: ; Array[0] = Amount of titles/windows found ; ; Failure - Blank string and sets @error ; 1 - Process doesn't exist ; Author(s) - Zisly ; Notes - If there are multiple windows it will return an array if $bM is set to true ;=============================================================================== Func _ProcessGetWinTitle($SProcess, $bM = False) If Not ProcessExists($SProcess) Then SetError(1) Return '' EndIf Local $a_WinT[1] = [1] Local $a_Processes = ProcessList() Local $a_WinList = WinList() If Not @error Then For $i = 1 To $a_WinList[0][0] $i_PID = WinGetProcess($a_WinList[$i][0]) For $o = 1 To $a_Processes[0][0] If $bM = True Then If $a_Processes[$o][1] = $i_PID And $a_Processes[$o][0] = $SProcess Then ReDim $a_WinT[$a_WinT[0] + 1] $a_WinT[$a_WinT[0]] = $a_WinList[$i][0] $a_WinT[0] += 1 EndIf Else If $a_Processes[$o][1] = $i_PID And $a_Processes[$o][0] = $SProcess Then Return $a_WinList[$i][0] EndIf Next Next $a_WinT[0] -= 1 Return $a_WinT EndIf EndFunc ;==>_ProcessGetWinTitle Any tips to improve? Edited July 1, 2009 by Zisly Link to comment Share on other sites More sharing options...
Iuli Posted July 1, 2009 Share Posted July 1, 2009 It's already been made . Look here [size="2"]SFXMaker[/size] - The most complete switchless installer creator software[indent][/indent] Link to comment Share on other sites More sharing options...
Zisly Posted July 1, 2009 Author Share Posted July 1, 2009 Dammit Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now