How to get job handle if I have HANDLE to one of the windows of the job

My application tried to scrape IE8, here we somehow obtain HANDLE to Internet Explorer Window/UI. Now I want to get the job handle for IE8. One Idea is to - Determine first the process id using the IE Window HANDLE using GetWindowThreadProcessId() but after this I am stuck.

There is new implementation in IE8, here every tab opened is a process within a job. Thus IE8 we see is managed as a job.

Answers


I couldn't find any documented way to get the job to which a process is bound; also, I couldn't find any documented way to enumerate all the jobs in the system, except the WMI way that however works only from XP onwards (which I don't think it's a problem since you're targeting IE8) and only with named jobs (which may actually be a problem if IE8 uses anonymous job objects).

If IE's jobs are in this list, then the road is downhill: just use OpenJobObject on each job name you can get (or, if you manage to narrow down your work with some heuristic on the job names, even better) and use the IsProcessInJob to check if your process handle (which you get with OpenProcess + GetWindowThreadProcessId) belongs to the job; once you get a match, you're set. Remember to close all those handles! :)

In the unfortunate event that the job objects used by IE8 are unnamed, then the whole thing becomes more difficult. You probably need to resort to almost-undocumented (by Microsoft, but widely documented on the net) handle-enumeration techniques to enumerate all the handles relative to your target process. You can then filter out just the job objects handles, and use the technique described above to get the right one.


By the way, why do you need to access the job objects used by IE8?


Need Your Help

php detect and convert dates from a string

php regex string date

I was wondering if I could somehow to detect a date in a string and convert it into a standard date format.

How to execute Orientdb server side function from Orientjs?

javascript orientdb

I am using Orientjs to access a Orientdb database from a nodejs script, but the server side function does not effect the database.