Jump to content
Sign in to follow this  


Recommended Posts


Hello, I made a little function which I to find the title of a process windows.

; 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
        Return ''
    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
                    If $a_Processes[$o][1] = $i_PID And $a_Processes[$o][0] = $SProcess Then Return $a_WinList[$i][0]
        $a_WinT[0] -= 1
        Return $a_WinT
EndFunc  ;==>_ProcessGetWinTitle

Any tips to improve? :)

Edited by Zisly

Share this post

Link to post
Share on other sites

It's already been made . Look here :)

[size="2"]SFXMaker[/size] - The most complete switchless installer creator software[indent][/indent]

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.