Sign in to follow this  
Followers 0
vladedoty

ProcessGetState??

6 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

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  
Followers 0