oktoberfest2 Posted March 20, 2008 Posted March 20, 2008 First let me ask this question...For any processid, is there an associated window handle?If the answer is no, then I probably need to look no further.What I'm trying to do is get a window handle based on a processid. Something that has been asked many times on the forum. I believe I may have hit two road blocks.1. The processid I'm trying to get a window handle to is a Windows Service2. If I remote desktop into a server, will the WinList() function see only windows related to my sessionID or can it retrieve all windows from all sessions (including the console session)?The ProcessList() function will return the PID of the service. I'm trying to use the UDF '_ProcessGetHWnd' but it does not return a valid window handle.An example process to try would be clipsrv.exeThanks
Moderators SmOke_N Posted March 20, 2008 Moderators Posted March 20, 2008 First let me ask this question...For any processid, is there an associated window handle?If the answer is no, then I probably need to look no further.Not all processes are GUI... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Kip Posted March 20, 2008 Posted March 20, 2008 $PID = WinGetProcess("Windows Live Messenger") $HWnd = _ProcessGetHWnd($PID) MsgBox(0,"title", WinGetTitle($HWnd)) Func _ProcessGetHWnd($PID) local $WinList = WinList() local $Return = 0 for $i = 1 to $WinList[0][0] if WinGetProcess($WinList[$i][1]) = $PID Then $Return = $WinList[$i][1] ExitLoop EndIf Next Return $Return EndFunc MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Moderators SmOke_N Posted March 20, 2008 Moderators Posted March 20, 2008 $PID = WinGetProcess("Windows Live Messenger") $HWnd = _ProcessGetHWnd($PID) MsgBox(0,"title", WinGetTitle($HWnd)) Func _ProcessGetHWnd($PID) local $WinList = WinList() local $Return = 0 for $i = 1 to $WinList[0][0] if WinGetProcess($WinList[$i][1]) = $PID Then $Return = $WinList[$i][1] ExitLoop EndIf Next Return $Return EndFuncHe's already stated he's used that kip Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Kip Posted March 20, 2008 Posted March 20, 2008 I'm trying to use the UDF '_ProcessGetHWnd' but it does not return a valid window handle.that script was my own script, and not the UDF he found somewhere. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Moderators SmOke_N Posted March 20, 2008 Moderators Posted March 20, 2008 that script was my own script, and not the UDF he found somewhere.Which will return the same exact results.... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Kip Posted March 20, 2008 Posted March 20, 2008 A process like clipsrv.exe doesnt have a Gui, like most services. @oktoberfest2: Is the process ,you want to do stuff with, in the processlist of the taskmanager? (something different than "System.exe") MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
oktoberfest2 Posted March 25, 2008 Author Posted March 25, 2008 A process like clipsrv.exe doesnt have a Gui, like most services.@oktoberfest2: Is the process ,you want to do stuff with, in the processlist of the taskmanager? (something different than "System.exe")The process is an executable file that runs as a service. It may very well be that the process is not a Gui. What I'm trying to do is run the SQL Server profiler utility and filter based on certain criteria, one of which is application name. This particular process/service runs but has no application name. I was trying to see if it was possible to get a handle to it and somehow set a title or something so that the profiler utility would pick it up so I could filter on it. Right now the only thing I have to go on is the client process id which can change when the computer is rebooted or the service is stopped and restarted.Thanks.
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