Jump to content

Recommended Posts

Posted

Is there a way to get a process's state

like wingetstate but instead processgetstate?

or another way i am overlooking?

thx in advance for the help

Posted

ok so lets say i have a process of an exe like notepad.exe running in the background

i would like to get the handle of that process.

then find out whether its currently visible, minimized, active, etc

Posted

Is there some reason you have a process name to start with but not a window name, HWND, etc.? You can get the HWND and title of all windows with WinList. Then maybe this will help:

Other than that more information is needed about what you are working with, like why is the process the starting point and not something else?

Posted

Here is a snippet I saved from somewhere, not sure where:

Func _GetHwndFromPID($PID)
    $hWnd = 0
    $stPID = DllStructCreate("int")
    Do
        $winlist2 = WinList()
        For $i = 1 To $winlist2[0][0]
            If $winlist2[$i][0] <> "" Then
                DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $winlist2[$i][1], "ptr", DllStructGetPtr($stPID))
                If DllStructGetData($stPID, 1) = $PID Then
                    $hWnd = $winlist2[$i][1]
                    ExitLoop
                EndIf
            EndIf
        Next
        Sleep(100)
    Until $hWnd <> 0
    Return $hWnd
EndFunc ;==>_GetHwndFromPID

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
×
×
  • Create New...