MadBoy Posted December 27, 2006 Share Posted December 27, 2006 Hey, Wanted to know if it's possible to control some window when i actually know only PID or process name? For example i wanted to control sysdm.cpl, but all i know is rundll32.exe process being opened and it's PID. I don't want to use TitleNames as it will vary with each language. So how would i know that sysdm.cpl was actually on TOP of all other windows so i could control it and switch some things in there (for example drivers signing option). I've been trying some possibilities but maybe there's some i missed. Run("control.exe sysdm.cpl") tnx for help. My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
Valuater Posted December 27, 2006 Share Posted December 27, 2006 This should helphttp://www.autoitscript.com/forum/index.ph...ost&p=57357there are a few, but this looks good8) Link to comment Share on other sites More sharing options...
improbability_paradox Posted December 28, 2006 Share Posted December 28, 2006 (edited) My own contribution CODEFunc _GetWHNDLFromPID($PID) Local $wHndl="", $WCCount=0, $WList Do Local $WList=WinList() for $WLCount= 1 to $WList[0][0] if WinGetProcess($WList[$WLCount][1])=$PID Then $wHndl=$WList[$WLCount][1] ExitLoop EndIf Next if $WCCount = 400 Then Return -1 Sleep(50) $WCCount += 1 Until not($wHndl="") Return $wHndl EndFunc Although, upon reviewing the thread which Valuater referenced, this does essentially the same thing as one of the functions listed there. Edited December 31, 2006 by improbability_paradox Link to comment Share on other sites More sharing options...
MadBoy Posted December 28, 2006 Author Share Posted December 28, 2006 Tnx!!! WIll take a look at it!! My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
improbability_paradox Posted December 28, 2006 Share Posted December 28, 2006 (edited) Updated the code in my post, as one of the variables was spelled incorrectly at one point Edit #2 Removed an un-needed EndIf Edited December 31, 2006 by improbability_paradox Link to comment Share on other sites More sharing options...
Helge Posted December 29, 2006 Share Posted December 29, 2006 (edited) I've just uploaded a updated version of my old ProcessGetHWnd with a new timeout-parameter andsome other smaller changes. It can return a single HWnd matching a PID and an optional title and itcan also return all matching HWnd's in array. Files :- http://www.autoitscript.com/fileman/users/Helge/udfs/_ProcessGetHWnd.au3- http://www.autoitscript.com/fileman/users/Helge/udfs/_ProcessGetHWnd_test.au3EDIT : Updated test. Edited December 29, 2006 by Helge Link to comment Share on other sites More sharing options...
MadBoy Posted January 2, 2007 Author Share Posted January 2, 2007 (edited) I've just uploaded a updated version of my old ProcessGetHWnd with a new timeout-parameter andsome other smaller changes. It can return a single HWnd matching a PID and an optional title and itcan also return all matching HWnd's in array. Files :- http://www.autoitscript.com/fileman/users/Helge/udfs/_ProcessGetHWnd.au3- http://www.autoitscript.com/fileman/users/Helge/udfs/_ProcessGetHWnd_test.au3EDIT : Updated test.Tnx boys, but i seems to have problem with what i am trying to achieve.I'm trying to control window that i am first trying to start with Run("control.exe sysdm.cpl").After that command i check for process rundll32.exe which seems to be the one that is responsible for that. But even when i use PID of rundll32.exe with Helge functions, tests it says it doesn't find any matching windows. So anyone have solution for this?EDIT: my bad. seems the window has to be active on screen for the script to work.. Edited January 2, 2007 by MadBoy My little company: Evotec (PL version: Evotec) 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