vladedoty Posted July 1, 2012 Posted July 1, 2012 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
AdmiralAlkex Posted July 1, 2012 Posted July 1, 2012 Processes don't have states like that. What is it you want to do? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
vladedoty Posted July 1, 2012 Author Posted July 1, 2012 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
AdmiralAlkex Posted July 1, 2012 Posted July 1, 2012 Those are attributes for a window, not a process. You want WinGetState(). .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
John Posted July 1, 2012 Posted July 1, 2012 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?
John Posted July 1, 2012 Posted July 1, 2012 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
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